1<html>
2<head>
3<title>pcre2_serialize_encode specification</title>
4</head>
5<body bgcolor="#FFFFFF" text="#00005A" link="#0066FF" alink="#3399FF" vlink="#2222BB">
6<h1>pcre2_serialize_encode man page</h1>
7<p>
8Return to the <a href="index.html">PCRE2 index page</a>.
9</p>
10<p>
11This page is part of the PCRE2 HTML documentation. It was generated
12automatically from the original man page. If there is any nonsense in it,
13please consult the man page, in case the conversion went wrong.
14<br>
15<br><b>
16SYNOPSIS
17</b><br>
18<P>
19<b>#include &#60;pcre2.h&#62;</b>
20</P>
21<P>
22<b>int32_t pcre2_serialize_encode(const pcre2_code **<i>codes</i>,</b>
23<b>  int32_t <i>number_of_codes</i>, uint8_t **<i>serialized_bytes</i>,</b>
24<b>  PCRE2_SIZE *<i>serialized_size</i>, pcre2_general_context *<i>gcontext</i>);</b>
25</P>
26<br><b>
27DESCRIPTION
28</b><br>
29<P>
30This function encodes a list of compiled patterns into a byte stream that can
31be saved on disc or elsewhere. Its arguments are:
32<pre>
33  <i>codes</i>             pointer to a vector containing the list
34  <i>number_of_codes</i>   number of slots in the vector
35  <i>serialized_bytes</i>  set to point to the serialized byte stream
36  <i>serialized_size</i>   set to the number of bytes in the byte stream
37  <i>gcontext</i>          pointer to a general context or NULL
38</pre>
39The context argument is used to obtain memory for the byte stream. When the
40serialized data is no longer needed, it must be freed by calling
41<b>pcre2_serialize_free()</b>. The yield of the function is the number of
42serialized patterns, or one of the following negative error codes:
43<pre>
44  PCRE2_ERROR_BADDATA      <i>number_of_codes</i> is zero or less
45  PCRE2_ERROR_BADMAGIC     mismatch of id bytes in one of the patterns
46  PCRE2_ERROR_MEMORY       memory allocation failed
47  PCRE2_ERROR_MIXEDTABLES  the patterns do not all use the same tables
48  PCRE2_ERROR_NULL         an argument other than <i>gcontext</i> is NULL
49</pre>
50PCRE2_ERROR_BADMAGIC means either that a pattern's code has been corrupted, or
51that a slot in the vector does not point to a compiled pattern.
52</P>
53<P>
54There is a complete description of the PCRE2 native API in the
55<a href="pcre2api.html"><b>pcre2api</b></a>
56page and a description of the POSIX API in the
57<a href="pcre2posix.html"><b>pcre2posix</b></a>
58page.
59<p>
60Return to the <a href="index.html">PCRE2 index page</a>.
61</p>
62