1PCRE2_SERIALIZE_ENCODE(3) Library Functions Manual PCRE2_SERIALIZE_ENCODE(3)
2
3
4
6 PCRE2 - Perl-compatible regular expressions (revised API)
7
9
10 #include <pcre2.h>
11
12 int32_t pcre2_serialize_encode(const pcre2_code **codes,
13 int32_t number_of_codes, uint8_t **serialized_bytes,
14 PCRE2_SIZE *serialized_size, pcre2_general_context *gcontext);
15
17
18 This function encodes a list of compiled patterns into a byte stream
19 that can be saved on disc or elsewhere. Its arguments are:
20
21 codes pointer to a vector containing the list
22 number_of_codes number of slots in the vector
23 serialized_bytes set to point to the serialized byte stream
24 serialized_size set to the number of bytes in the byte stream
25 gcontext pointer to a general context or NULL
26
27 The context argument is used to obtain memory for the byte stream. When
28 the serialized data is no longer needed, it must be freed by calling
29 pcre2_serialize_free(). The yield of the function is the number of
30 serialized patterns, or one of the following negative error codes:
31
32 PCRE2_ERROR_BADDATA number_of_codes is zero or less
33 PCRE2_ERROR_BADMAGIC mismatch of id bytes in one of the patterns
34 PCRE2_ERROR_MEMORY memory allocation failed
35 PCRE2_ERROR_MIXEDTABLES the patterns do not all use the same tables
36 PCRE2_ERROR_NULL an argument other than gcontext is NULL
37
38 PCRE2_ERROR_BADMAGIC means either that a pattern's code has been cor‐
39 rupted, or that a slot in the vector does not point to a compiled pat‐
40 tern.
41
42 There is a complete description of the PCRE2 native API in the pcre2api
43 page and a description of the POSIX API in the pcre2posix page.
44
45
46
47PCRE2 10.21 02 September 2015 PCRE2_SERIALIZE_ENCODE(3)