.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * lib/ts_bm.c Boyer-Moore text search implementation |
---|
3 | | - * |
---|
4 | | - * This program is free software; you can redistribute it and/or |
---|
5 | | - * modify it under the terms of the GNU General Public License |
---|
6 | | - * as published by the Free Software Foundation; either version |
---|
7 | | - * 2 of the License, or (at your option) any later version. |
---|
8 | 4 | * |
---|
9 | 5 | * Authors: Pablo Neira Ayuso <pablo@eurodev.net> |
---|
10 | 6 | * |
---|
.. | .. |
---|
15 | 11 | * [1] A Fast String Searching Algorithm, R.S. Boyer and Moore. |
---|
16 | 12 | * Communications of the Association for Computing Machinery, |
---|
17 | 13 | * 20(10), 1977, pp. 762-772. |
---|
18 | | - * http://www.cs.utexas.edu/users/moore/publications/fstrpos.pdf |
---|
| 14 | + * https://www.cs.utexas.edu/users/moore/publications/fstrpos.pdf |
---|
19 | 15 | * |
---|
20 | 16 | * [2] Handbook of Exact String Matching Algorithms, Thierry Lecroq, 2004 |
---|
21 | 17 | * http://www-igm.univ-mlv.fr/~lecroq/string/string.pdf |
---|
.. | .. |
---|
56 | 52 | u8 * pattern; |
---|
57 | 53 | unsigned int patlen; |
---|
58 | 54 | unsigned int bad_shift[ASIZE]; |
---|
59 | | - unsigned int good_shift[0]; |
---|
| 55 | + unsigned int good_shift[]; |
---|
60 | 56 | }; |
---|
61 | 57 | |
---|
62 | 58 | static unsigned int bm_find(struct ts_config *conf, struct ts_state *state) |
---|
.. | .. |
---|
64 | 60 | struct ts_bm *bm = ts_config_priv(conf); |
---|
65 | 61 | unsigned int i, text_len, consumed = state->offset; |
---|
66 | 62 | const u8 *text; |
---|
67 | | - int shift = bm->patlen - 1, bs; |
---|
| 63 | + int bs; |
---|
68 | 64 | const u8 icase = conf->flags & TS_IGNORECASE; |
---|
69 | 65 | |
---|
70 | 66 | for (;;) { |
---|
| 67 | + int shift = bm->patlen - 1; |
---|
| 68 | + |
---|
71 | 69 | text_len = conf->get_next_block(consumed, &text, conf, state); |
---|
72 | 70 | |
---|
73 | 71 | if (unlikely(text_len == 0)) |
---|