MCPcopy Create free account
hub / github.com/git/git / build_charclass_op

Function build_charclass_op

compat/regex/regcomp.c:3616–3722  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3614 BUILD_CHARCLASS_LOOP (isgraph);
3615 else if (strcmp (class_name, "punct") == 0)
3616 BUILD_CHARCLASS_LOOP (ispunct);
3617 else if (strcmp (class_name, "xdigit") == 0)
3618 BUILD_CHARCLASS_LOOP (isxdigit);
3619 else
3620 return REG_ECTYPE;
3621
3622 return REG_NOERROR;
3623}
3624
3625static bin_tree_t *
3626build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans,
3627 const char *class_name,
3628 const char *extra, int non_match,
3629 reg_errcode_t *err)
3630{
3631 re_bitset_ptr_t sbcset;
3632#ifdef RE_ENABLE_I18N
3633 re_charset_t *mbcset;
3634 int alloc = 0;
3635#endif /* not RE_ENABLE_I18N */
3636 reg_errcode_t ret;
3637 re_token_t br_token;
3638 bin_tree_t *tree;
3639
3640 sbcset = (re_bitset_ptr_t) calloc (1, sizeof (bitset_t));
3641#ifdef RE_ENABLE_I18N
3642 mbcset = (re_charset_t *) calloc (1, sizeof (re_charset_t));
3643#endif /* RE_ENABLE_I18N */
3644
3645#ifdef RE_ENABLE_I18N
3646 if (BE (sbcset == NULL || mbcset == NULL, 0))
3647#else /* not RE_ENABLE_I18N */
3648 if (BE (sbcset == NULL, 0))
3649#endif /* not RE_ENABLE_I18N */
3650 {
3651 *err = REG_ESPACE;
3652 return NULL;
3653 }
3654
3655 if (non_match)
3656 {
3657#ifdef RE_ENABLE_I18N
3658 mbcset->non_match = 1;
3659#endif /* not RE_ENABLE_I18N */
3660 }
3661
3662 /* We don't care the syntax in this case. */
3663 ret = build_charclass (trans, sbcset,
3664#ifdef RE_ENABLE_I18N
3665 mbcset, &alloc,
3666#endif /* RE_ENABLE_I18N */
3667 class_name, 0);
3668
3669 if (BE (ret != REG_NOERROR, 0))
3670 {
3671 re_free (sbcset);
3672#ifdef RE_ENABLE_I18N
3673 free_charset (mbcset);

Callers 1

parse_expressionFunction · 0.85

Calls 5

free_charsetFunction · 0.85
bitset_notFunction · 0.85
bitset_maskFunction · 0.85
create_token_treeFunction · 0.85
create_treeFunction · 0.85

Tested by

no test coverage detected