| 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 | |
| 2797 | static bin_tree_t * |
| 2798 | parse_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 | } |
no test coverage detected