-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move project to PCRE2 as PCRE is EOL and won't receive any security updates anymore. PCRE2 have different API compared to PCRE. Mainly PCRE2 have the concept of match_data, no ovector needs to be passed, different handling for error string and different handling for substring manipulation. Update any user of PCRE library with the new API Signed-off-by: Christian Marangi <[email protected]>
- Loading branch information
Showing
41 changed files
with
488 additions
and
339 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ DOWNLOAD=http://files.freeswitch.org/downloads/libs | |
JPEG=v8d | ||
OPENSSL=1.0.1l | ||
SQLITE=autoconf-3080403 | ||
PCRE=8.35 | ||
PCRE2=10.42 | ||
CURL=7.40.0 | ||
SPEEX=1.2rc1 | ||
LIBEDIT=20140618-3.1 | ||
|
@@ -45,7 +45,7 @@ has-git: | |
@git --version || (echo "please install git by running 'make install-git'" && false) | ||
|
||
clean: | ||
@rm -rf openssl* ldns* jpeg* pcre* perl* pkg-config* speex* sqlite* libedit* curl* *~ | ||
@rm -rf openssl* ldns* jpeg* pcre2* perl* pkg-config* speex* sqlite* libedit* curl* *~ | ||
(cd freeswitch.git && git clean -fdx && git reset --hard HEAD && git pull) | ||
|
||
libjpeg: jpeg-8d/.done | ||
|
@@ -66,9 +66,9 @@ sqlite-$(SQLITE): | |
(test -d $@) || (wget -4 -O [email protected] $(DOWNLOAD)/[email protected] && tar zxfv [email protected]) | ||
(cd $@ && ./configure --prefix=$(PREFIX) && make && sudo make install && touch .done_sqlite && touch .done) | ||
|
||
pcre: pcre-$(PCRE)/.done | ||
pcre-$(PCRE)/.done: pcre-$(PCRE) | ||
pcre-$(PCRE): | ||
pcre2: pcre2-$(PCRE2)/.done | ||
pcre2-$(PCRE2)/.done: pcre2-$(PCRE2) | ||
pcre2-$(PCRE2): | ||
(test -d $@) || (wget -4 -O [email protected] $(DOWNLOAD)/[email protected] && tar zxfv [email protected]) | ||
(cd $@ && ./configure --prefix=$(PREFIX) && make && sudo make install && touch .done) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ DOWNLOAD=http://files.freeswitch.org/downloads/libs | |
JP=v8d | ||
SSL=1.0.1j | ||
SQLITE=autoconf-3080403 | ||
PCRE=8.35 | ||
PCRE2=10.42 | ||
CURL=7.35.0 | ||
SPEEX=1.2rc1 | ||
LIBEDIT=20140618-3.1 | ||
|
@@ -43,7 +43,7 @@ has-git: | |
@git --version || (echo "please install git by running 'gmake install-git'" && false) | ||
|
||
clean: | ||
@rm -rf openssl* ldns* jpeg* pcre* perl* pkg-config* speex* sqlite* libedit* curl* *~ | ||
@rm -rf openssl* ldns* jpeg* pcre2* perl* pkg-config* speex* sqlite* libedit* curl* *~ | ||
(cd freeswitch.git && git clean -fdx && git reset --hard HEAD && git pull) | ||
|
||
libjpeg: jpeg-8d/.done | ||
|
@@ -64,9 +64,9 @@ sqlite-$(SQLITE): | |
(test -d $@) || (wget -4 -O [email protected] $(DOWNLOAD)/[email protected] && tar zxfv [email protected]) | ||
(cd $@ && CFLAGS=-m64 LDFLAGS=-m64 ./configure --prefix=$(PREFIX) && gmake && sudo gmake install && touch .done) | ||
|
||
pcre: pcre-$(PCRE)/.done | ||
pcre-$(PCRE)/.done: pcre-$(PCRE) | ||
pcre-$(PCRE): | ||
pcre2: pcre2-$(PCRE2)/.done | ||
pcre2-$(PCRE2)/.done: pcre2-$(PCRE2) | ||
pcre2-$(PCRE2): | ||
(test -d $@) || (wget -4 -O [email protected] $(DOWNLOAD)/[email protected] && tar zxfv [email protected]) | ||
(cd $@ && CXXFLAGS=-m64 CFLAGS=-m64 LDFLAGS=-m64 ./configure --prefix=$(PREFIX) && gmake && sudo gmake install && touch .done) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
* | ||
* Michael Jerris <[email protected]> | ||
* | ||
* switch_regex.h -- pcre wrapper and extensions Header | ||
* switch_regex.h -- pcre2 wrapper and extensions Header | ||
* | ||
*/ | ||
/*! \file switch_regex.h | ||
|
@@ -40,18 +40,21 @@ SWITCH_BEGIN_EXTERN_C | |
* @ingroup FREESWITCH | ||
* @{ | ||
*/ | ||
typedef struct real_pcre switch_regex_t; | ||
typedef struct pcre2_real_code switch_regex_t; | ||
typedef struct pcre2_real_match_data_8 switch_regex_match_data_t; | ||
typedef struct pcre2_real_compile_context_8 switch_regex_compile_context_t; | ||
|
||
SWITCH_DECLARE(switch_regex_t *) switch_regex_compile(const char *pattern, int options, const char **errorptr, int *erroroffset, | ||
const unsigned char *tables); | ||
SWITCH_DECLARE(switch_regex_t *) switch_regex_compile(const char *pattern, int options, int *errorcode, unsigned int *erroroffset, | ||
switch_regex_compile_context_t *ccontext); | ||
|
||
SWITCH_DECLARE(int) switch_regex_copy_substring(const char *subject, int *ovector, int stringcount, int stringnumber, char *buffer, int size); | ||
SWITCH_DECLARE(int) switch_regex_copy_substring(switch_regex_match_data_t *match_data, int stringnumber, char *buffer, unsigned int *size); | ||
|
||
SWITCH_DECLARE(void) switch_regex_match_free(void *data); | ||
SWITCH_DECLARE(void) switch_regex_free(void *data); | ||
|
||
SWITCH_DECLARE(int) switch_regex_perform(const char *field, const char *expression, switch_regex_t **new_re, int *ovector, uint32_t olen); | ||
SWITCH_DECLARE(void) switch_perform_substitution(switch_regex_t *re, int match_count, const char *data, const char *field_data, | ||
char *substituted, switch_size_t len, int *ovector); | ||
SWITCH_DECLARE(int) switch_regex_perform(const char *field, const char *expression, switch_regex_t **new_re, switch_regex_match_data_t **new_match_data); | ||
SWITCH_DECLARE(void) switch_perform_substitution(switch_regex_match_data_t *match_data, const char *data, | ||
char *substituted, switch_size_t len); | ||
|
||
/*! | ||
\brief Function to evaluate an expression against a string | ||
|
@@ -70,17 +73,27 @@ SWITCH_DECLARE(switch_status_t) switch_regex_match(const char *target, const cha | |
*/ | ||
SWITCH_DECLARE(switch_status_t) switch_regex_match_partial(const char *target, const char *expression, int *partial_match); | ||
|
||
SWITCH_DECLARE(void) switch_capture_regex(switch_regex_t *re, int match_count, const char *field_data, | ||
int *ovector, const char *var, switch_cap_callback_t callback, void *user_data); | ||
SWITCH_DECLARE(void) switch_capture_regex(switch_regex_match_data_t *match_data, int match_count, | ||
const char *var, switch_cap_callback_t callback, void *user_data); | ||
|
||
SWITCH_DECLARE_NONSTD(void) switch_regex_set_var_callback(const char *var, const char *val, void *user_data); | ||
SWITCH_DECLARE_NONSTD(void) switch_regex_set_event_header_callback(const char *var, const char *val, void *user_data); | ||
|
||
#define switch_match_data_safe_free(match_data) if (match_data) {\ | ||
switch_regex_match_free(match_data);\ | ||
match_data = NULL;\ | ||
} | ||
|
||
#define switch_regex_safe_free(re) if (re) {\ | ||
switch_regex_free(re);\ | ||
re = NULL;\ | ||
} | ||
|
||
#define switch_regex_and_match_data_safe_free(re, match_data) {\ | ||
switch_match_data_safe_free(match_data);\ | ||
switch_regex_safe_free(re);\ | ||
} | ||
|
||
|
||
/** @} */ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.