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

Function parse_bracket_exp

compat/regex/regcomp.c:2788–3342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2786 else
2787 {
2788 bitset_set (sbcset, name[0]);
2789 return REG_NOERROR;
2790 }
2791}
2792#endif /* not _LIBC */
2793
2794/* This function parse bracket expression like "[abc]", "[a-c]",
2795 "[[.a-a.]]" etc. */
2796
2797static bin_tree_t *
2798parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
2799 reg_syntax_t syntax, reg_errcode_t *err)
2800{
2801#ifdef _LIBC
2802 const unsigned char *collseqmb;
2803 const char *collseqwc;
2804 uint32_t nrules;
2805 int32_t table_size;
2806 const int32_t *symb_table;
2807 const unsigned char *extra;
2808
2809 /* Local function for parse_bracket_exp used in _LIBC environment.
2810 Seek the collating symbol entry correspondings to NAME.
2811 Return the index of the symbol in the SYMB_TABLE. */
2812
2813 auto inline int32_t
2814 __attribute ((always_inline))
2815 seek_collating_symbol_entry (name, name_len)
2816 const unsigned char *name;
2817 size_t name_len;
2818 {
2819 int32_t hash = elem_hash ((const char *) name, name_len);
2820 int32_t elem = hash % table_size;
2821 if (symb_table[2 * elem] != 0)
2822 {
2823 int32_t second = hash % (table_size - 2) + 1;
2824
2825 do
2826 {
2827 /* First compare the hashing value. */
2828 if (symb_table[2 * elem] == hash
2829 /* Compare the length of the name. */
2830 && name_len == extra[symb_table[2 * elem + 1]]
2831 /* Compare the name. */
2832 && memcmp (name, &extra[symb_table[2 * elem + 1] + 1],
2833 name_len) == 0)
2834 {
2835 /* Yep, this is the entry. */
2836 break;
2837 }
2838
2839 /* Next entry. */
2840 elem += second;
2841 }
2842 while (symb_table[2 * elem] != 0);
2843 }
2844 return elem;
2845 }

Callers 1

parse_expressionFunction · 0.85

Calls 9

peek_token_bracketFunction · 0.85
parse_bracket_elementFunction · 0.85
build_range_expFunction · 0.85
build_collating_symbolFunction · 0.85
bitset_notFunction · 0.85
bitset_maskFunction · 0.85
create_token_treeFunction · 0.85
create_treeFunction · 0.85
free_charsetFunction · 0.85

Tested by

no test coverage detected