Lines Matching refs:bm

64 	struct ts_bm *bm = ts_config_priv(conf);  in bm_find()  local
67 int shift = bm->patlen - 1, bs; in bm_find()
79 for (i = 0; i < bm->patlen; i++) in bm_find()
82 != bm->pattern[bm->patlen-1-i]) in bm_find()
87 return consumed += (shift-(bm->patlen-1)); in bm_find()
89 next: bs = bm->bad_shift[text[shift-i]]; in bm_find()
92 shift = max_t(int, shift-i+bs, shift+bm->good_shift[i]); in bm_find()
118 static void compute_prefix_tbl(struct ts_bm *bm, int flags) in compute_prefix_tbl() argument
123 bm->bad_shift[i] = bm->patlen; in compute_prefix_tbl()
124 for (i = 0; i < bm->patlen - 1; i++) { in compute_prefix_tbl()
125 bm->bad_shift[bm->pattern[i]] = bm->patlen - 1 - i; in compute_prefix_tbl()
127 bm->bad_shift[tolower(bm->pattern[i])] in compute_prefix_tbl()
128 = bm->patlen - 1 - i; in compute_prefix_tbl()
133 bm->good_shift[0] = 1; in compute_prefix_tbl()
134 for (i = 1; i < bm->patlen; i++) in compute_prefix_tbl()
135 bm->good_shift[i] = bm->patlen; in compute_prefix_tbl()
136 for (i = bm->patlen-1, g = 1; i > 0; g++, i--) { in compute_prefix_tbl()
138 if (subpattern(bm->pattern, i, j, g)) { in compute_prefix_tbl()
139 bm->good_shift[g] = bm->patlen-j-g; in compute_prefix_tbl()
149 struct ts_bm *bm; in bm_init() local
152 size_t priv_size = sizeof(*bm) + len + prefix_tbl_len; in bm_init()
159 bm = ts_config_priv(conf); in bm_init()
160 bm->patlen = len; in bm_init()
161 bm->pattern = (u8 *) bm->good_shift + prefix_tbl_len; in bm_init()
164 bm->pattern[i] = toupper(((u8 *)pattern)[i]); in bm_init()
166 memcpy(bm->pattern, pattern, len); in bm_init()
167 compute_prefix_tbl(bm, flags); in bm_init()
174 struct ts_bm *bm = ts_config_priv(conf); in bm_get_pattern() local
175 return bm->pattern; in bm_get_pattern()
180 struct ts_bm *bm = ts_config_priv(conf); in bm_get_pattern_len() local
181 return bm->patlen; in bm_get_pattern_len()