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

Function lookup_collation_sequence_value

compat/regex/regcomp.c:2842–2902  ·  view source on GitHub ↗
(br_elem)

Source from the content-addressed store, hash-verified

2840 elem += second;
2841 }
2842 while (symb_table[2 * elem] != 0);
2843 }
2844 return elem;
2845 }
2846
2847 /* Local function for parse_bracket_exp used in _LIBC environment.
2848 Look up the collation sequence value of BR_ELEM.
2849 Return the value if succeeded, UINT_MAX otherwise. */
2850
2851 auto inline unsigned int
2852 __attribute ((always_inline))
2853 lookup_collation_sequence_value (br_elem)
2854 bracket_elem_t *br_elem;
2855 {
2856 if (br_elem->type == SB_CHAR)
2857 {
2858 /*
2859 if (MB_CUR_MAX == 1)
2860 */
2861 if (nrules == 0)
2862 return collseqmb[br_elem->opr.ch];
2863 else
2864 {
2865 wint_t wc = __btowc (br_elem->opr.ch);
2866 return __collseq_table_lookup (collseqwc, wc);
2867 }
2868 }
2869 else if (br_elem->type == MB_CHAR)
2870 {
2871 if (nrules != 0)
2872 return __collseq_table_lookup (collseqwc, br_elem->opr.wch);
2873 }
2874 else if (br_elem->type == COLL_SYM)
2875 {
2876 size_t sym_name_len = strlen ((char *) br_elem->opr.name);
2877 if (nrules != 0)
2878 {
2879 int32_t elem, idx;
2880 elem = seek_collating_symbol_entry (br_elem->opr.name,
2881 sym_name_len);
2882 if (symb_table[2 * elem] != 0)
2883 {
2884 /* We found the entry. */
2885 idx = symb_table[2 * elem + 1];
2886 /* Skip the name of collating element name. */
2887 idx += 1 + extra[idx];
2888 /* Skip the byte sequence of the collating element. */
2889 idx += 1 + extra[idx];
2890 /* Adjust for the alignment. */
2891 idx = (idx + 3) & ~3;
2892 /* Skip the multibyte collation sequence value. */
2893 idx += sizeof (unsigned int);
2894 /* Skip the wide char sequence of the collating element. */
2895 idx += sizeof (unsigned int) *
2896 (1 + *(unsigned int *) (extra + idx));
2897 /* Return the collation sequence value. */
2898 return *(unsigned int *) (extra + idx);
2899 }

Callers 1

build_range_expFunction · 0.85

Calls 1

Tested by

no test coverage detected