From 7a0cc794dddd65ef825571056b71e3fca7f4f315 Mon Sep 17 00:00:00 2001 From: Patrik Nyblom Date: Mon, 15 Jul 2013 11:23:38 +0200 Subject: Add erts_prefix to pcre_library and update erl_bif_re --- erts/emulator/beam/erl_bif_re.c | 2 +- erts/emulator/pcre/pcre.h | 149 +++++++++++++++++++++++++++++++++- erts/emulator/pcre/pcre_byte_order.c | 5 ++ erts/emulator/pcre/pcre_compile.c | 17 ++++ erts/emulator/pcre/pcre_config.c | 5 ++ erts/emulator/pcre/pcre_dfa_exec.c | 7 ++ erts/emulator/pcre/pcre_exec.c | 9 +- erts/emulator/pcre/pcre_fullinfo.c | 6 ++ erts/emulator/pcre/pcre_get.c | 89 ++++++++++++++++++++ erts/emulator/pcre/pcre_internal.h | 9 ++ erts/emulator/pcre/pcre_jit_compile.c | 37 +++++++++ erts/emulator/pcre/pcre_maketables.c | 5 ++ erts/emulator/pcre/pcre_refcount.c | 5 ++ erts/emulator/pcre/pcre_study.c | 20 +++++ erts/emulator/pcre/pcre_version.c | 5 ++ 15 files changed, 365 insertions(+), 5 deletions(-) diff --git a/erts/emulator/beam/erl_bif_re.c b/erts/emulator/beam/erl_bif_re.c index 3d34c2a77f..4289c79ba2 100644 --- a/erts/emulator/beam/erl_bif_re.c +++ b/erts/emulator/beam/erl_bif_re.c @@ -492,7 +492,7 @@ typedef struct _return_info { } ReturnInfo; typedef struct _restart_context { - pcre_extra extra; + erts_pcre_extra extra; void *restart_data; Uint32 flags; char *subject; /* to be able to free it when done */ diff --git a/erts/emulator/pcre/pcre.h b/erts/emulator/pcre/pcre.h index 9a056a15ee..57efdd01f5 100644 --- a/erts/emulator/pcre/pcre.h +++ b/erts/emulator/pcre/pcre.h @@ -375,7 +375,11 @@ const char *. */ such as way as to be extensible. Always add new fields at the end, in order to remain compatible. */ +#if defined(ERLANG_INTEGRATION) +typedef struct erts_pcre_extra { +#else typedef struct pcre_extra { +#endif unsigned long int flags; /* Bits for which fields are set */ void *study_data; /* Opaque data from pcre_study() */ unsigned long int match_limit; /* Maximum number of calls to match() */ @@ -389,8 +393,10 @@ typedef struct pcre_extra { unsigned long *loop_counter_return; void **restart_data; /* in/out */ int restart_flags; -#endif +} erts_pcre_extra; +#else } pcre_extra; +#endif /* Same structure as above, but with 16 bit char pointers. */ @@ -423,7 +429,11 @@ structure so that new fields can be added on the end in future versions, without changing the API of the function, thereby allowing old clients to work without modification. */ +#if defined(ERLANG_INTEGRATION) +typedef struct erts_pcre_callout_block { +#else typedef struct pcre_callout_block { +#endif int version; /* Identifies version of block */ /* ------------------------ Version 0 ------------------------------- */ int callout_number; /* Number compiled into pattern */ @@ -441,8 +451,11 @@ typedef struct pcre_callout_block { /* ------------------- Added for Version 2 -------------------------- */ const unsigned char *mark; /* Pointer to current mark or NULL */ /* ------------------------------------------------------------------ */ +#if defined(ERLANG_INTEGRATION) +} erts_pcre_callout_block; +#else } pcre_callout_block; - +#endif /* Same structure as above, but with 16 bit char pointers. */ typedef struct pcre16_callout_block { @@ -494,12 +507,19 @@ that is triggered by the (?) regex item. For Virtual Pascal, these definitions have to take another form. */ #ifndef VPCOMPAT +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL void *(*erts_pcre_malloc)(size_t); +PCRE_EXP_DECL void (*erts_pcre_free)(void *); +PCRE_EXP_DECL void *(*erts_pcre_stack_malloc)(size_t); +PCRE_EXP_DECL void (*erts_pcre_stack_free)(void *); +PCRE_EXP_DECL int (*erts_pcre_callout)(erts_pcre_callout_block *); +#else PCRE_EXP_DECL void *(*pcre_malloc)(size_t); PCRE_EXP_DECL void (*pcre_free)(void *); PCRE_EXP_DECL void *(*pcre_stack_malloc)(size_t); PCRE_EXP_DECL void (*pcre_stack_free)(void *); PCRE_EXP_DECL int (*pcre_callout)(pcre_callout_block *); - +#endif PCRE_EXP_DECL void *(*pcre16_malloc)(size_t); PCRE_EXP_DECL void (*pcre16_free)(void *); PCRE_EXP_DECL void *(*pcre16_stack_malloc)(size_t); @@ -512,11 +532,19 @@ PCRE_EXP_DECL void *(*pcre32_stack_malloc)(size_t); PCRE_EXP_DECL void (*pcre32_stack_free)(void *); PCRE_EXP_DECL int (*pcre32_callout)(pcre32_callout_block *); #else /* VPCOMPAT */ +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL void *erts_pcre_malloc(size_t); +PCRE_EXP_DECL void erts_pcre_free(void *); +PCRE_EXP_DECL void *erts_pcre_stack_malloc(size_t); +PCRE_EXP_DECL void erts_pcre_stack_free(void *); +PCRE_EXP_DECL int erts_pcre_callout(erts_pcre_callout_block *); +#else PCRE_EXP_DECL void *pcre_malloc(size_t); PCRE_EXP_DECL void pcre_free(void *); PCRE_EXP_DECL void *pcre_stack_malloc(size_t); PCRE_EXP_DECL void pcre_stack_free(void *); PCRE_EXP_DECL int pcre_callout(pcre_callout_block *); +#endif PCRE_EXP_DECL void *pcre16_malloc(size_t); PCRE_EXP_DECL void pcre16_free(void *); @@ -539,112 +567,214 @@ typedef pcre32_jit_stack *(*pcre32_jit_callback)(void *); /* Exported PCRE functions */ +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL pcre *erts_pcre_compile(const char *, int, const char **, int *, + const unsigned char *); +#else PCRE_EXP_DECL pcre *pcre_compile(const char *, int, const char **, int *, const unsigned char *); +#endif PCRE_EXP_DECL pcre16 *pcre16_compile(PCRE_SPTR16, int, const char **, int *, const unsigned char *); PCRE_EXP_DECL pcre32 *pcre32_compile(PCRE_SPTR32, int, const char **, int *, const unsigned char *); +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL pcre *erts_pcre_compile2(const char *, int, int *, const char **, + int *, const unsigned char *); +#else PCRE_EXP_DECL pcre *pcre_compile2(const char *, int, int *, const char **, int *, const unsigned char *); +#endif PCRE_EXP_DECL pcre16 *pcre16_compile2(PCRE_SPTR16, int, int *, const char **, int *, const unsigned char *); PCRE_EXP_DECL pcre32 *pcre32_compile2(PCRE_SPTR32, int, int *, const char **, int *, const unsigned char *); +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL int erts_pcre_config(int, void *); +#else PCRE_EXP_DECL int pcre_config(int, void *); +#endif PCRE_EXP_DECL int pcre16_config(int, void *); PCRE_EXP_DECL int pcre32_config(int, void *); +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL int erts_pcre_copy_named_substring(const pcre *, const char *, + int *, int, const char *, char *, int); +#else PCRE_EXP_DECL int pcre_copy_named_substring(const pcre *, const char *, int *, int, const char *, char *, int); +#endif PCRE_EXP_DECL int pcre16_copy_named_substring(const pcre16 *, PCRE_SPTR16, int *, int, PCRE_SPTR16, PCRE_UCHAR16 *, int); PCRE_EXP_DECL int pcre32_copy_named_substring(const pcre32 *, PCRE_SPTR32, int *, int, PCRE_SPTR32, PCRE_UCHAR32 *, int); +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL int erts_pcre_copy_substring(const char *, int *, int, int, + char *, int); +#else PCRE_EXP_DECL int pcre_copy_substring(const char *, int *, int, int, char *, int); +#endif PCRE_EXP_DECL int pcre16_copy_substring(PCRE_SPTR16, int *, int, int, PCRE_UCHAR16 *, int); PCRE_EXP_DECL int pcre32_copy_substring(PCRE_SPTR32, int *, int, int, PCRE_UCHAR32 *, int); +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL int erts_pcre_dfa_exec(const pcre *, const erts_pcre_extra *, + const char *, int, int, int, int *, int , int *, int); +#else PCRE_EXP_DECL int pcre_dfa_exec(const pcre *, const pcre_extra *, const char *, int, int, int, int *, int , int *, int); +#endif PCRE_EXP_DECL int pcre16_dfa_exec(const pcre16 *, const pcre16_extra *, PCRE_SPTR16, int, int, int, int *, int , int *, int); PCRE_EXP_DECL int pcre32_dfa_exec(const pcre32 *, const pcre32_extra *, PCRE_SPTR32, int, int, int, int *, int , int *, int); +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL int erts_pcre_exec(const pcre *, const erts_pcre_extra *, PCRE_SPTR, + int, int, int, int *, int); +#else PCRE_EXP_DECL int pcre_exec(const pcre *, const pcre_extra *, PCRE_SPTR, int, int, int, int *, int); +#endif PCRE_EXP_DECL int pcre16_exec(const pcre16 *, const pcre16_extra *, PCRE_SPTR16, int, int, int, int *, int); PCRE_EXP_DECL int pcre32_exec(const pcre32 *, const pcre32_extra *, PCRE_SPTR32, int, int, int, int *, int); +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL int erts_pcre_jit_exec(const pcre *, const erts_pcre_extra *, + PCRE_SPTR, int, int, int, int *, int, + pcre_jit_stack *); +#else PCRE_EXP_DECL int pcre_jit_exec(const pcre *, const pcre_extra *, PCRE_SPTR, int, int, int, int *, int, pcre_jit_stack *); +#endif PCRE_EXP_DECL int pcre16_jit_exec(const pcre16 *, const pcre16_extra *, PCRE_SPTR16, int, int, int, int *, int, pcre16_jit_stack *); PCRE_EXP_DECL int pcre32_jit_exec(const pcre32 *, const pcre32_extra *, PCRE_SPTR32, int, int, int, int *, int, pcre32_jit_stack *); +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL void erts_pcre_free_substring(const char *); +#else PCRE_EXP_DECL void pcre_free_substring(const char *); +#endif PCRE_EXP_DECL void pcre16_free_substring(PCRE_SPTR16); PCRE_EXP_DECL void pcre32_free_substring(PCRE_SPTR32); +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL void erts_pcre_free_substring_list(const char **); +#else PCRE_EXP_DECL void pcre_free_substring_list(const char **); +#endif PCRE_EXP_DECL void pcre16_free_substring_list(PCRE_SPTR16 *); PCRE_EXP_DECL void pcre32_free_substring_list(PCRE_SPTR32 *); +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL int erts_pcre_fullinfo(const pcre *, const erts_pcre_extra *, int, + void *); +#else PCRE_EXP_DECL int pcre_fullinfo(const pcre *, const pcre_extra *, int, void *); +#endif PCRE_EXP_DECL int pcre16_fullinfo(const pcre16 *, const pcre16_extra *, int, void *); PCRE_EXP_DECL int pcre32_fullinfo(const pcre32 *, const pcre32_extra *, int, void *); +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL int erts_pcre_get_named_substring(const pcre *, const char *, + int *, int, const char *, const char **); +#else PCRE_EXP_DECL int pcre_get_named_substring(const pcre *, const char *, int *, int, const char *, const char **); +#endif PCRE_EXP_DECL int pcre16_get_named_substring(const pcre16 *, PCRE_SPTR16, int *, int, PCRE_SPTR16, PCRE_SPTR16 *); PCRE_EXP_DECL int pcre32_get_named_substring(const pcre32 *, PCRE_SPTR32, int *, int, PCRE_SPTR32, PCRE_SPTR32 *); +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL int erts_pcre_get_stringnumber(const pcre *, const char *); +#else PCRE_EXP_DECL int pcre_get_stringnumber(const pcre *, const char *); +#endif PCRE_EXP_DECL int pcre16_get_stringnumber(const pcre16 *, PCRE_SPTR16); PCRE_EXP_DECL int pcre32_get_stringnumber(const pcre32 *, PCRE_SPTR32); +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL int erts_pcre_get_stringtable_entries(const pcre *, const char *, + char **, char **); +#else PCRE_EXP_DECL int pcre_get_stringtable_entries(const pcre *, const char *, char **, char **); +#endif PCRE_EXP_DECL int pcre16_get_stringtable_entries(const pcre16 *, PCRE_SPTR16, PCRE_UCHAR16 **, PCRE_UCHAR16 **); PCRE_EXP_DECL int pcre32_get_stringtable_entries(const pcre32 *, PCRE_SPTR32, PCRE_UCHAR32 **, PCRE_UCHAR32 **); +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL int erts_pcre_get_substring(const char *, int *, int, int, + const char **); +#else PCRE_EXP_DECL int pcre_get_substring(const char *, int *, int, int, const char **); +#endif PCRE_EXP_DECL int pcre16_get_substring(PCRE_SPTR16, int *, int, int, PCRE_SPTR16 *); PCRE_EXP_DECL int pcre32_get_substring(PCRE_SPTR32, int *, int, int, PCRE_SPTR32 *); +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL int erts_pcre_get_substring_list(const char *, int *, int, + const char ***); +#else PCRE_EXP_DECL int pcre_get_substring_list(const char *, int *, int, const char ***); +#endif PCRE_EXP_DECL int pcre16_get_substring_list(PCRE_SPTR16, int *, int, PCRE_SPTR16 **); PCRE_EXP_DECL int pcre32_get_substring_list(PCRE_SPTR32, int *, int, PCRE_SPTR32 **); +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL const unsigned char *erts_pcre_maketables(void); +#else PCRE_EXP_DECL const unsigned char *pcre_maketables(void); +#endif PCRE_EXP_DECL const unsigned char *pcre16_maketables(void); PCRE_EXP_DECL const unsigned char *pcre32_maketables(void); +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL int erts_pcre_refcount(pcre *, int); +#else PCRE_EXP_DECL int pcre_refcount(pcre *, int); +#endif PCRE_EXP_DECL int pcre16_refcount(pcre16 *, int); PCRE_EXP_DECL int pcre32_refcount(pcre32 *, int); +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL erts_pcre_extra *erts_pcre_study(const pcre *, int, const char **); +#else PCRE_EXP_DECL pcre_extra *pcre_study(const pcre *, int, const char **); +#endif PCRE_EXP_DECL pcre16_extra *pcre16_study(const pcre16 *, int, const char **); PCRE_EXP_DECL pcre32_extra *pcre32_study(const pcre32 *, int, const char **); +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL void erts_pcre_free_study(erts_pcre_extra *); +#else PCRE_EXP_DECL void pcre_free_study(pcre_extra *); +#endif PCRE_EXP_DECL void pcre16_free_study(pcre16_extra *); PCRE_EXP_DECL void pcre32_free_study(pcre32_extra *); +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL const char *erts_pcre_version(void); +#else PCRE_EXP_DECL const char *pcre_version(void); +#endif PCRE_EXP_DECL const char *pcre16_version(void); PCRE_EXP_DECL const char *pcre32_version(void); /* Utility functions for byte order swaps. */ +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL int erts_pcre_pattern_to_host_byte_order(pcre *, erts_pcre_extra *, + const unsigned char *); +#else PCRE_EXP_DECL int pcre_pattern_to_host_byte_order(pcre *, pcre_extra *, const unsigned char *); +#endif PCRE_EXP_DECL int pcre16_pattern_to_host_byte_order(pcre16 *, pcre16_extra *, const unsigned char *); PCRE_EXP_DECL int pcre32_pattern_to_host_byte_order(pcre32 *, pcre32_extra *, @@ -656,14 +786,27 @@ PCRE_EXP_DECL int pcre32_utf32_to_host_byte_order(PCRE_UCHAR32 *, /* JIT compiler related functions. */ +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL pcre_jit_stack *erts_pcre_jit_stack_alloc(int, int); +#else PCRE_EXP_DECL pcre_jit_stack *pcre_jit_stack_alloc(int, int); +#endif PCRE_EXP_DECL pcre16_jit_stack *pcre16_jit_stack_alloc(int, int); PCRE_EXP_DECL pcre32_jit_stack *pcre32_jit_stack_alloc(int, int); +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL void erts_pcre_jit_stack_free(pcre_jit_stack *); +#else PCRE_EXP_DECL void pcre_jit_stack_free(pcre_jit_stack *); +#endif PCRE_EXP_DECL void pcre16_jit_stack_free(pcre16_jit_stack *); PCRE_EXP_DECL void pcre32_jit_stack_free(pcre32_jit_stack *); +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL void erts_pcre_assign_jit_stack(erts_pcre_extra *, + pcre_jit_callback, void *); +#else PCRE_EXP_DECL void pcre_assign_jit_stack(pcre_extra *, pcre_jit_callback, void *); +#endif PCRE_EXP_DECL void pcre16_assign_jit_stack(pcre16_extra *, pcre16_jit_callback, void *); PCRE_EXP_DECL void pcre32_assign_jit_stack(pcre32_extra *, diff --git a/erts/emulator/pcre/pcre_byte_order.c b/erts/emulator/pcre/pcre_byte_order.c index 7f8457742d..710676988f 100644 --- a/erts/emulator/pcre/pcre_byte_order.c +++ b/erts/emulator/pcre/pcre_byte_order.c @@ -96,8 +96,13 @@ Returns: 0 if the swap is successful, negative on error */ #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL int erts_pcre_pattern_to_host_byte_order(pcre *argument_re, + erts_pcre_extra *extra_data, const unsigned char *tables) +#else PCRE_EXP_DECL int pcre_pattern_to_host_byte_order(pcre *argument_re, pcre_extra *extra_data, const unsigned char *tables) +#endif #elif defined COMPILE_PCRE16 PCRE_EXP_DECL int pcre16_pattern_to_host_byte_order(pcre16 *argument_re, pcre16_extra *extra_data, const unsigned char *tables) diff --git a/erts/emulator/pcre/pcre_compile.c b/erts/emulator/pcre/pcre_compile.c index 5652bad0ce..d48126a55d 100644 --- a/erts/emulator/pcre/pcre_compile.c +++ b/erts/emulator/pcre/pcre_compile.c @@ -7728,9 +7728,15 @@ Returns: pointer to compiled data block, or NULL on error, */ #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DEFN pcre * PCRE_CALL_CONVENTION +erts_pcre_compile(const char *pattern, int options, const char **errorptr, + int *erroroffset, const unsigned char *tables) +#else PCRE_EXP_DEFN pcre * PCRE_CALL_CONVENTION pcre_compile(const char *pattern, int options, const char **errorptr, int *erroroffset, const unsigned char *tables) +#endif #elif defined COMPILE_PCRE16 PCRE_EXP_DEFN pcre16 * PCRE_CALL_CONVENTION pcre16_compile(PCRE_SPTR16 pattern, int options, const char **errorptr, @@ -7742,7 +7748,12 @@ pcre32_compile(PCRE_SPTR32 pattern, int options, const char **errorptr, #endif { #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +return erts_pcre_compile2(pattern, options, NULL, errorptr, + erroroffset, tables); +#else return pcre_compile2(pattern, options, NULL, errorptr, erroroffset, tables); +#endif #elif defined COMPILE_PCRE16 return pcre16_compile2(pattern, options, NULL, errorptr, erroroffset, tables); #elif defined COMPILE_PCRE32 @@ -7752,9 +7763,15 @@ return pcre32_compile2(pattern, options, NULL, errorptr, erroroffset, tables); #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DEFN pcre * PCRE_CALL_CONVENTION +erts_pcre_compile2(const char *pattern, int options, int *errorcodeptr, + const char **errorptr, int *erroroffset, const unsigned char *tables) +#else PCRE_EXP_DEFN pcre * PCRE_CALL_CONVENTION pcre_compile2(const char *pattern, int options, int *errorcodeptr, const char **errorptr, int *erroroffset, const unsigned char *tables) +#endif #elif defined COMPILE_PCRE16 PCRE_EXP_DEFN pcre16 * PCRE_CALL_CONVENTION pcre16_compile2(PCRE_SPTR16 pattern, int options, int *errorcodeptr, diff --git a/erts/emulator/pcre/pcre_config.c b/erts/emulator/pcre/pcre_config.c index a116cc7ac6..06fa3d324f 100644 --- a/erts/emulator/pcre/pcre_config.c +++ b/erts/emulator/pcre/pcre_config.c @@ -71,8 +71,13 @@ Returns: 0 if data returned, negative on error */ #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DEFN int PCRE_CALL_CONVENTION +erts_pcre_config(int what, void *where) +#else PCRE_EXP_DEFN int PCRE_CALL_CONVENTION pcre_config(int what, void *where) +#endif #elif defined COMPILE_PCRE16 PCRE_EXP_DEFN int PCRE_CALL_CONVENTION pcre16_config(int what, void *where) diff --git a/erts/emulator/pcre/pcre_dfa_exec.c b/erts/emulator/pcre/pcre_dfa_exec.c index 9e00552163..f5718a3b33 100644 --- a/erts/emulator/pcre/pcre_dfa_exec.c +++ b/erts/emulator/pcre/pcre_dfa_exec.c @@ -3099,10 +3099,17 @@ Returns: > 0 => number of match offset pairs placed in offsets */ #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DEFN int PCRE_CALL_CONVENTION +erts_pcre_dfa_exec(const pcre *argument_re, const erts_pcre_extra *extra_data, + const char *subject, int length, int start_offset, int options, int *offsets, + int offsetcount, int *workspace, int wscount) +#else PCRE_EXP_DEFN int PCRE_CALL_CONVENTION pcre_dfa_exec(const pcre *argument_re, const pcre_extra *extra_data, const char *subject, int length, int start_offset, int options, int *offsets, int offsetcount, int *workspace, int wscount) +#endif #elif defined COMPILE_PCRE16 PCRE_EXP_DEFN int PCRE_CALL_CONVENTION pcre16_dfa_exec(const pcre16 *argument_re, const pcre16_extra *extra_data, diff --git a/erts/emulator/pcre/pcre_exec.c b/erts/emulator/pcre/pcre_exec.c index 54c0fe59a1..0371f9efa8 100644 --- a/erts/emulator/pcre/pcre_exec.c +++ b/erts/emulator/pcre/pcre_exec.c @@ -6681,10 +6681,17 @@ typedef struct { #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DEFN int PCRE_CALL_CONVENTION +erts_pcre_exec(const pcre *argument_re, const erts_pcre_extra *extra_data, + PCRE_SPTR subject, int length, int start_offset, int options, int *offsets, + int offsetcount) +#else PCRE_EXP_DEFN int PCRE_CALL_CONVENTION pcre_exec(const pcre *argument_re, const pcre_extra *extra_data, PCRE_SPTR subject, int length, int start_offset, int options, int *offsets, int offsetcount) +#endif #elif defined COMPILE_PCRE16 PCRE_EXP_DEFN int PCRE_CALL_CONVENTION pcre16_exec(const pcre16 *argument_re, const pcre16_extra *extra_data, @@ -6804,7 +6811,7 @@ pcre_uchar req_char; } else { if (extra_data != NULL && (extra_data->flags & PCRE_EXTRA_LOOP_LIMIT)) { - exec_context = (PcreExecContext *) (PUBL(malloc))(sizeof(PcreExecContext)); + exec_context = (PcreExecContext *) (erts_pcre_malloc)(sizeof(PcreExecContext)); *(extra_data->restart_data) = (void *) exec_context; /* need freeing by special routine from client */ } else { diff --git a/erts/emulator/pcre/pcre_fullinfo.c b/erts/emulator/pcre/pcre_fullinfo.c index 80a080a758..1636c5978f 100644 --- a/erts/emulator/pcre/pcre_fullinfo.c +++ b/erts/emulator/pcre/pcre_fullinfo.c @@ -67,9 +67,15 @@ Returns: 0 if data returned, negative on error */ #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DEFN int PCRE_CALL_CONVENTION +erts_pcre_fullinfo(const pcre *argument_re, const erts_pcre_extra *extra_data, + int what, void *where) +#else PCRE_EXP_DEFN int PCRE_CALL_CONVENTION pcre_fullinfo(const pcre *argument_re, const pcre_extra *extra_data, int what, void *where) +#endif #elif defined COMPILE_PCRE16 PCRE_EXP_DEFN int PCRE_CALL_CONVENTION pcre16_fullinfo(const pcre16 *argument_re, const pcre16_extra *extra_data, diff --git a/erts/emulator/pcre/pcre_get.c b/erts/emulator/pcre/pcre_get.c index cc669ead38..c0bb21bbbf 100644 --- a/erts/emulator/pcre/pcre_get.c +++ b/erts/emulator/pcre/pcre_get.c @@ -67,8 +67,13 @@ Returns: the number of the named parentheses, or a negative number */ #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DEFN int PCRE_CALL_CONVENTION +erts_pcre_get_stringnumber(const pcre *code, const char *stringname) +#else PCRE_EXP_DEFN int PCRE_CALL_CONVENTION pcre_get_stringnumber(const pcre *code, const char *stringname) +#endif #elif defined COMPILE_PCRE16 PCRE_EXP_DEFN int PCRE_CALL_CONVENTION pcre16_get_stringnumber(const pcre16 *code, PCRE_SPTR16 stringname) @@ -83,6 +88,16 @@ int top, bot; pcre_uchar *nametable; #ifdef COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +if ((rc = erts_pcre_fullinfo(code, NULL, PCRE_INFO_NAMECOUNT, &top)) != 0) + return rc; +if (top <= 0) return PCRE_ERROR_NOSUBSTRING; + +if ((rc = erts_pcre_fullinfo(code, NULL, PCRE_INFO_NAMEENTRYSIZE, &entrysize)) != 0) + return rc; +if ((rc = erts_pcre_fullinfo(code, NULL, PCRE_INFO_NAMETABLE, &nametable)) != 0) + return rc; +#else if ((rc = pcre_fullinfo(code, NULL, PCRE_INFO_NAMECOUNT, &top)) != 0) return rc; if (top <= 0) return PCRE_ERROR_NOSUBSTRING; @@ -92,6 +107,7 @@ if ((rc = pcre_fullinfo(code, NULL, PCRE_INFO_NAMEENTRYSIZE, &entrysize)) != 0) if ((rc = pcre_fullinfo(code, NULL, PCRE_INFO_NAMETABLE, &nametable)) != 0) return rc; #endif +#endif #ifdef COMPILE_PCRE16 if ((rc = pcre16_fullinfo(code, NULL, PCRE_INFO_NAMECOUNT, &top)) != 0) return rc; @@ -147,9 +163,15 @@ Returns: the length of each entry, or a negative number */ #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DEFN int PCRE_CALL_CONVENTION +erts_pcre_get_stringtable_entries(const pcre *code, const char *stringname, + char **firstptr, char **lastptr) +#else PCRE_EXP_DEFN int PCRE_CALL_CONVENTION pcre_get_stringtable_entries(const pcre *code, const char *stringname, char **firstptr, char **lastptr) +#endif #elif defined COMPILE_PCRE16 PCRE_EXP_DEFN int PCRE_CALL_CONVENTION pcre16_get_stringtable_entries(const pcre16 *code, PCRE_SPTR16 stringname, @@ -166,6 +188,16 @@ int top, bot; pcre_uchar *nametable, *lastentry; #ifdef COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +if ((rc = erts_pcre_fullinfo(code, NULL, PCRE_INFO_NAMECOUNT, &top)) != 0) + return rc; +if (top <= 0) return PCRE_ERROR_NOSUBSTRING; + +if ((rc = erts_pcre_fullinfo(code, NULL, PCRE_INFO_NAMEENTRYSIZE, &entrysize)) != 0) + return rc; +if ((rc = erts_pcre_fullinfo(code, NULL, PCRE_INFO_NAMETABLE, &nametable)) != 0) + return rc; +#else if ((rc = pcre_fullinfo(code, NULL, PCRE_INFO_NAMECOUNT, &top)) != 0) return rc; if (top <= 0) return PCRE_ERROR_NOSUBSTRING; @@ -175,6 +207,7 @@ if ((rc = pcre_fullinfo(code, NULL, PCRE_INFO_NAMEENTRYSIZE, &entrysize)) != 0) if ((rc = pcre_fullinfo(code, NULL, PCRE_INFO_NAMETABLE, &nametable)) != 0) return rc; #endif +#endif #ifdef COMPILE_PCRE16 if ((rc = pcre16_fullinfo(code, NULL, PCRE_INFO_NAMECOUNT, &top)) != 0) return rc; @@ -280,9 +313,15 @@ PCRE_UCHAR32 *first, *last; #endif #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +if ((re->options & PCRE_DUPNAMES) == 0 && (re->flags & PCRE_JCHANGED) == 0) + return erts_pcre_get_stringnumber(code, stringname); +entrysize = erts_pcre_get_stringtable_entries(code, stringname, &first, &last); +#else if ((re->options & PCRE_DUPNAMES) == 0 && (re->flags & PCRE_JCHANGED) == 0) return pcre_get_stringnumber(code, stringname); entrysize = pcre_get_stringtable_entries(code, stringname, &first, &last); +#endif #elif defined COMPILE_PCRE16 if ((re->options & PCRE_DUPNAMES) == 0 && (re->flags & PCRE_JCHANGED) == 0) return pcre16_get_stringnumber(code, stringname); @@ -332,9 +371,15 @@ Returns: if successful: */ #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DEFN int PCRE_CALL_CONVENTION +erts_pcre_copy_substring(const char *subject, int *ovector, int stringcount, + int stringnumber, char *buffer, int size) +#else PCRE_EXP_DEFN int PCRE_CALL_CONVENTION pcre_copy_substring(const char *subject, int *ovector, int stringcount, int stringnumber, char *buffer, int size) +#endif #elif defined COMPILE_PCRE16 PCRE_EXP_DEFN int PCRE_CALL_CONVENTION pcre16_copy_substring(PCRE_SPTR16 subject, int *ovector, int stringcount, @@ -387,10 +432,17 @@ Returns: if successful: */ #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DEFN int PCRE_CALL_CONVENTION +erts_pcre_copy_named_substring(const pcre *code, const char *subject, + int *ovector, int stringcount, const char *stringname, + char *buffer, int size) +#else PCRE_EXP_DEFN int PCRE_CALL_CONVENTION pcre_copy_named_substring(const pcre *code, const char *subject, int *ovector, int stringcount, const char *stringname, char *buffer, int size) +#endif #elif defined COMPILE_PCRE16 PCRE_EXP_DEFN int PCRE_CALL_CONVENTION pcre16_copy_named_substring(const pcre16 *code, PCRE_SPTR16 subject, @@ -406,7 +458,11 @@ pcre32_copy_named_substring(const pcre32 *code, PCRE_SPTR32 subject, int n = get_first_set(code, stringname, ovector); if (n <= 0) return n; #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +return erts_pcre_copy_substring(subject, ovector, stringcount, n, buffer, size); +#else return pcre_copy_substring(subject, ovector, stringcount, n, buffer, size); +#endif #elif defined COMPILE_PCRE16 return pcre16_copy_substring(subject, ovector, stringcount, n, buffer, size); #elif defined COMPILE_PCRE32 @@ -438,9 +494,15 @@ Returns: if successful: 0 */ #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DEFN int PCRE_CALL_CONVENTION +erts_pcre_get_substring_list(const char *subject, int *ovector, int stringcount, + const char ***listptr) +#else PCRE_EXP_DEFN int PCRE_CALL_CONVENTION pcre_get_substring_list(const char *subject, int *ovector, int stringcount, const char ***listptr) +#endif #elif defined COMPILE_PCRE16 PCRE_EXP_DEFN int PCRE_CALL_CONVENTION pcre16_get_substring_list(PCRE_SPTR16 subject, int *ovector, int stringcount, @@ -500,8 +562,13 @@ Returns: nothing */ #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DEFN void PCRE_CALL_CONVENTION +erts_pcre_free_substring_list(const char **pointer) +#else PCRE_EXP_DEFN void PCRE_CALL_CONVENTION pcre_free_substring_list(const char **pointer) +#endif #elif defined COMPILE_PCRE16 PCRE_EXP_DEFN void PCRE_CALL_CONVENTION pcre16_free_substring_list(PCRE_SPTR16 *pointer) @@ -541,9 +608,15 @@ Returns: if successful: */ #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DEFN int PCRE_CALL_CONVENTION +erts_pcre_get_substring(const char *subject, int *ovector, int stringcount, + int stringnumber, const char **stringptr) +#else PCRE_EXP_DEFN int PCRE_CALL_CONVENTION pcre_get_substring(const char *subject, int *ovector, int stringcount, int stringnumber, const char **stringptr) +#endif #elif defined COMPILE_PCRE16 PCRE_EXP_DEFN int PCRE_CALL_CONVENTION pcre16_get_substring(PCRE_SPTR16 subject, int *ovector, int stringcount, @@ -604,10 +677,17 @@ Returns: if successful: */ #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DEFN int PCRE_CALL_CONVENTION +erts_pcre_get_named_substring(const pcre *code, const char *subject, + int *ovector, int stringcount, const char *stringname, + const char **stringptr) +#else PCRE_EXP_DEFN int PCRE_CALL_CONVENTION pcre_get_named_substring(const pcre *code, const char *subject, int *ovector, int stringcount, const char *stringname, const char **stringptr) +#endif #elif defined COMPILE_PCRE16 PCRE_EXP_DEFN int PCRE_CALL_CONVENTION pcre16_get_named_substring(const pcre16 *code, PCRE_SPTR16 subject, @@ -623,7 +703,11 @@ pcre32_get_named_substring(const pcre32 *code, PCRE_SPTR32 subject, int n = get_first_set(code, stringname, ovector); if (n <= 0) return n; #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +return erts_pcre_get_substring(subject, ovector, stringcount, n, stringptr); +#else return pcre_get_substring(subject, ovector, stringcount, n, stringptr); +#endif #elif defined COMPILE_PCRE16 return pcre16_get_substring(subject, ovector, stringcount, n, stringptr); #elif defined COMPILE_PCRE32 @@ -647,8 +731,13 @@ Returns: nothing */ #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DEFN void PCRE_CALL_CONVENTION +erts_pcre_free_substring(const char *pointer) +#else PCRE_EXP_DEFN void PCRE_CALL_CONVENTION pcre_free_substring(const char *pointer) +#endif #elif defined COMPILE_PCRE16 PCRE_EXP_DEFN void PCRE_CALL_CONVENTION pcre16_free_substring(PCRE_SPTR16 pointer) diff --git a/erts/emulator/pcre/pcre_internal.h b/erts/emulator/pcre/pcre_internal.h index 1304a13c5d..af436bd99b 100644 --- a/erts/emulator/pcre/pcre_internal.h +++ b/erts/emulator/pcre/pcre_internal.h @@ -2600,12 +2600,21 @@ total length. */ /* Internal function and data prefixes. */ #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +#ifndef PUBL +#define PUBL(name) erts_pcre_##name +#endif +#ifndef PRIV +#define PRIV(name) _erts_pcre_##name +#endif +#else #ifndef PUBL #define PUBL(name) pcre_##name #endif #ifndef PRIV #define PRIV(name) _pcre_##name #endif +#endif #elif defined COMPILE_PCRE16 #ifndef PUBL #define PUBL(name) pcre16_##name diff --git a/erts/emulator/pcre/pcre_jit_compile.c b/erts/emulator/pcre/pcre_jit_compile.c index d0090d0e14..fb26c62817 100644 --- a/erts/emulator/pcre/pcre_jit_compile.c +++ b/erts/emulator/pcre/pcre_jit_compile.c @@ -9528,10 +9528,17 @@ return retval; } #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DEFN int PCRE_CALL_CONVENTION +erts_pcre_jit_exec(const pcre *argument_re, const pcre_extra *extra_data, + PCRE_SPTR subject, int length, int start_offset, int options, + int *offsets, int offset_count, pcre_jit_stack *stack) +#else PCRE_EXP_DEFN int PCRE_CALL_CONVENTION pcre_jit_exec(const pcre *argument_re, const pcre_extra *extra_data, PCRE_SPTR subject, int length, int start_offset, int options, int *offsets, int offset_count, pcre_jit_stack *stack) +#endif #elif defined COMPILE_PCRE16 PCRE_EXP_DEFN int PCRE_CALL_CONVENTION pcre16_jit_exec(const pcre16 *argument_re, const pcre16_extra *extra_data, @@ -9641,8 +9648,13 @@ return sljit_get_platform_name(); } #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL pcre_jit_stack * +erts_pcre_jit_stack_alloc(int startsize, int maxsize) +#else PCRE_EXP_DECL pcre_jit_stack * pcre_jit_stack_alloc(int startsize, int maxsize) +#endif #elif defined COMPILE_PCRE16 PCRE_EXP_DECL pcre16_jit_stack * pcre16_jit_stack_alloc(int startsize, int maxsize) @@ -9661,8 +9673,13 @@ return (PUBL(jit_stack)*)sljit_allocate_stack(startsize, maxsize); } #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL void +erts_pcre_jit_stack_free(pcre_jit_stack *stack) +#else PCRE_EXP_DECL void pcre_jit_stack_free(pcre_jit_stack *stack) +#endif #elif defined COMPILE_PCRE16 PCRE_EXP_DECL void pcre16_jit_stack_free(pcre16_jit_stack *stack) @@ -9675,8 +9692,13 @@ sljit_free_stack((struct sljit_stack *)stack); } #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL void +erts_pcre_assign_jit_stack(pcre_extra *extra, pcre_jit_callback callback, void *userdata) +#else PCRE_EXP_DECL void pcre_assign_jit_stack(pcre_extra *extra, pcre_jit_callback callback, void *userdata) +#endif #elif defined COMPILE_PCRE16 PCRE_EXP_DECL void pcre16_assign_jit_stack(pcre16_extra *extra, pcre16_jit_callback callback, void *userdata) @@ -9702,8 +9724,13 @@ if (extra != NULL && being compiled. */ #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL pcre_jit_stack * +erts_pcre_jit_stack_alloc(int startsize, int maxsize) +#else PCRE_EXP_DECL pcre_jit_stack * pcre_jit_stack_alloc(int startsize, int maxsize) +#endif #elif defined COMPILE_PCRE16 PCRE_EXP_DECL pcre16_jit_stack * pcre16_jit_stack_alloc(int startsize, int maxsize) @@ -9718,8 +9745,13 @@ return NULL; } #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL void +erts_pcre_jit_stack_free(pcre_jit_stack *stack) +#else PCRE_EXP_DECL void pcre_jit_stack_free(pcre_jit_stack *stack) +#endif #elif defined COMPILE_PCRE16 PCRE_EXP_DECL void pcre16_jit_stack_free(pcre16_jit_stack *stack) @@ -9732,8 +9764,13 @@ pcre32_jit_stack_free(pcre32_jit_stack *stack) } #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DECL void +erts_pcre_assign_jit_stack(erts_pcre_extra *extra, pcre_jit_callback callback, void *userdata) +#else PCRE_EXP_DECL void pcre_assign_jit_stack(pcre_extra *extra, pcre_jit_callback callback, void *userdata) +#endif #elif defined COMPILE_PCRE16 PCRE_EXP_DECL void pcre16_assign_jit_stack(pcre16_extra *extra, pcre16_jit_callback callback, void *userdata) diff --git a/erts/emulator/pcre/pcre_maketables.c b/erts/emulator/pcre/pcre_maketables.c index 7c4d58d558..9310d886fa 100644 --- a/erts/emulator/pcre/pcre_maketables.c +++ b/erts/emulator/pcre/pcre_maketables.c @@ -68,8 +68,13 @@ Returns: pointer to the contiguous block of data */ #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +const unsigned char * +erts_pcre_maketables(void) +#else const unsigned char * pcre_maketables(void) +#endif #elif defined COMPILE_PCRE16 const unsigned char * pcre16_maketables(void) diff --git a/erts/emulator/pcre/pcre_refcount.c b/erts/emulator/pcre/pcre_refcount.c index 5b2af2f47b..33d5a528af 100644 --- a/erts/emulator/pcre/pcre_refcount.c +++ b/erts/emulator/pcre/pcre_refcount.c @@ -70,8 +70,13 @@ Returns: the (possibly updated) count value (a non-negative number), or */ #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DEFN int PCRE_CALL_CONVENTION +erts_pcre_refcount(pcre *argument_re, int adjust) +#else PCRE_EXP_DEFN int PCRE_CALL_CONVENTION pcre_refcount(pcre *argument_re, int adjust) +#endif #elif defined COMPILE_PCRE16 PCRE_EXP_DEFN int PCRE_CALL_CONVENTION pcre16_refcount(pcre16 *argument_re, int adjust) diff --git a/erts/emulator/pcre/pcre_study.c b/erts/emulator/pcre/pcre_study.c index a85163094f..3d8961ffb0 100644 --- a/erts/emulator/pcre/pcre_study.c +++ b/erts/emulator/pcre/pcre_study.c @@ -1327,8 +1327,13 @@ Returns: pointer to a pcre[16]_extra block, with study_data filled in and */ #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DEFN erts_pcre_extra * PCRE_CALL_CONVENTION +erts_pcre_study(const pcre *external_re, int options, const char **errorptr) +#else PCRE_EXP_DEFN pcre_extra * PCRE_CALL_CONVENTION pcre_study(const pcre *external_re, int options, const char **errorptr) +#endif #elif defined COMPILE_PCRE16 PCRE_EXP_DEFN pcre16_extra * PCRE_CALL_CONVENTION pcre16_study(const pcre16 *external_re, int options, const char **errorptr) @@ -1390,9 +1395,15 @@ if ((re->options & PCRE_ANCHORED) == 0 && tables = re->tables; #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) + if (tables == NULL) + (void)erts_pcre_fullinfo(external_re, NULL, PCRE_INFO_DEFAULT_TABLES, + (void *)(&tables)); +#else if (tables == NULL) (void)pcre_fullinfo(external_re, NULL, PCRE_INFO_DEFAULT_TABLES, (void *)(&tables)); +#endif #elif defined COMPILE_PCRE16 if (tables == NULL) (void)pcre16_fullinfo(external_re, NULL, PCRE_INFO_DEFAULT_TABLES, @@ -1514,7 +1525,11 @@ if (bits_set || min > 0 || (options & ( (options & PCRE_STUDY_EXTRA_NEEDED) == 0) { #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) + erts_pcre_free_study(extra); +#else pcre_free_study(extra); +#endif #elif defined COMPILE_PCRE16 pcre16_free_study(extra); #elif defined COMPILE_PCRE32 @@ -1540,8 +1555,13 @@ Returns: nothing */ #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DEFN void +erts_pcre_free_study(erts_pcre_extra *extra) +#else PCRE_EXP_DEFN void pcre_free_study(pcre_extra *extra) +#endif #elif defined COMPILE_PCRE16 PCRE_EXP_DEFN void pcre16_free_study(pcre16_extra *extra) diff --git a/erts/emulator/pcre/pcre_version.c b/erts/emulator/pcre/pcre_version.c index f771b3e82b..cc4485e41f 100644 --- a/erts/emulator/pcre/pcre_version.c +++ b/erts/emulator/pcre/pcre_version.c @@ -81,8 +81,13 @@ pre-processor time. This hack uses a standard trick for avoiding calling the STRING macro with an empty argument when doing the test. */ #if defined COMPILE_PCRE8 +#if defined(ERLANG_INTEGRATION) +PCRE_EXP_DEFN const char * PCRE_CALL_CONVENTION +erts_pcre_version(void) +#else PCRE_EXP_DEFN const char * PCRE_CALL_CONVENTION pcre_version(void) +#endif #elif defined COMPILE_PCRE16 PCRE_EXP_DEFN const char * PCRE_CALL_CONVENTION pcre16_version(void) -- cgit v1.2.3