Use onig_new_without_alloc for onig_new
This commit is contained in:
parent
7633299c50
commit
f72f3ab15b
@ -6073,20 +6073,15 @@ onig_new(regex_t** reg, const UChar* pattern, const UChar* pattern_end,
|
|||||||
OnigOptionType option, OnigEncoding enc, const OnigSyntaxType* syntax,
|
OnigOptionType option, OnigEncoding enc, const OnigSyntaxType* syntax,
|
||||||
OnigErrorInfo* einfo)
|
OnigErrorInfo* einfo)
|
||||||
{
|
{
|
||||||
int r;
|
|
||||||
|
|
||||||
*reg = (regex_t* )xmalloc(sizeof(regex_t));
|
*reg = (regex_t* )xmalloc(sizeof(regex_t));
|
||||||
if (IS_NULL(*reg)) return ONIGERR_MEMORY;
|
if (IS_NULL(*reg)) return ONIGERR_MEMORY;
|
||||||
|
|
||||||
r = onig_reg_init(*reg, option, ONIGENC_CASE_FOLD_DEFAULT, enc, syntax);
|
int r = onig_new_without_alloc(*reg, pattern, pattern_end, option, enc, syntax, einfo);
|
||||||
if (r) goto err;
|
|
||||||
|
|
||||||
r = onig_compile(*reg, pattern, pattern_end, einfo);
|
|
||||||
if (r) {
|
if (r) {
|
||||||
err:
|
|
||||||
onig_free(*reg);
|
onig_free(*reg);
|
||||||
*reg = NULL;
|
*reg = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user