mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-28 19:55:53 +03:00
More compatibility
This commit is contained in:
parent
9dd174adee
commit
81852e8ab5
@ -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); \
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user