More compatibility

This commit is contained in:
Gavin Whelan 2014-04-09 16:12:51 -07:00
parent 9dd174adee
commit 81852e8ab5

View File

@ -274,10 +274,13 @@ cre2_strings_to_ranges (const char * text, cre2_range_t * ranges, cre2_string_t
cre2_string_t * match, int nmatch) \
{ \
re2::StringPiece input(text->data, text->length); \
re2::StringPiece strv[nmatch]; \
RE2::Arg argv[nmatch]; \
RE2::Arg * args[nmatch]; \
bool retval; \
re2::StringPiece *strv; \
RE2::Arg *argv; \
RE2::Arg * *args; \
bool retval; \
strv = (re2::StringPiece *) (malloc(sizeof(re2::StringPiece) *nmatch)); \
argv = (RE2::Arg *) (malloc(sizeof(RE2::Arg) *nmatch)); \
args = (RE2::Arg **) (malloc(sizeof(RE2::Arg *) *nmatch)); \
for (int i=0; i<nmatch; ++i) { \
argv[i] = &strv[i]; \
args[i] = &argv[i]; \
@ -289,6 +292,9 @@ cre2_strings_to_ranges (const char * text, cre2_range_t * ranges, cre2_string_t
match[i].length = strv[i].length(); \
} \
} \
free(strv); \
free(argv); \
free(args); \
return int(retval); \
}
@ -303,10 +309,13 @@ DEFINE_MATCH_ZSTRING_FUN(cre2_partial_match,PartialMatchN)
cre2_string_t * match, int nmatch) \
{ \
re2::StringPiece input(text->data, text->length); \
re2::StringPiece strv[nmatch]; \
RE2::Arg argv[nmatch]; \
RE2::Arg * args[nmatch]; \
bool retval; \
re2::StringPiece *strv; \
RE2::Arg *argv; \
RE2::Arg * *args; \
bool retval; \
strv = (re2::StringPiece *) (malloc(sizeof(re2::StringPiece) *nmatch)); \
argv = (RE2::Arg *) (malloc(sizeof(RE2::Arg) *nmatch)); \
args = (RE2::Arg **) (malloc(sizeof(RE2::Arg *) *nmatch)); \
for (int i=0; i<nmatch; ++i) { \
argv[i] = &strv[i]; \
args[i] = &argv[i]; \
@ -320,6 +329,9 @@ DEFINE_MATCH_ZSTRING_FUN(cre2_partial_match,PartialMatchN)
match[i].length = strv[i].length(); \
} \
} \
free(strv); \
free(argv); \
free(args); \
return int(retval); \
}