hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/lib/ts_bm.c
....@@ -1,10 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * 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.
84 *
95 * Authors: Pablo Neira Ayuso <pablo@eurodev.net>
106 *
....@@ -15,7 +11,7 @@
1511 * [1] A Fast String Searching Algorithm, R.S. Boyer and Moore.
1612 * Communications of the Association for Computing Machinery,
1713 * 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
1915 *
2016 * [2] Handbook of Exact String Matching Algorithms, Thierry Lecroq, 2004
2117 * http://www-igm.univ-mlv.fr/~lecroq/string/string.pdf
....@@ -56,7 +52,7 @@
5652 u8 * pattern;
5753 unsigned int patlen;
5854 unsigned int bad_shift[ASIZE];
59
- unsigned int good_shift[0];
55
+ unsigned int good_shift[];
6056 };
6157
6258 static unsigned int bm_find(struct ts_config *conf, struct ts_state *state)
....@@ -64,10 +60,12 @@
6460 struct ts_bm *bm = ts_config_priv(conf);
6561 unsigned int i, text_len, consumed = state->offset;
6662 const u8 *text;
67
- int shift = bm->patlen - 1, bs;
63
+ int bs;
6864 const u8 icase = conf->flags & TS_IGNORECASE;
6965
7066 for (;;) {
67
+ int shift = bm->patlen - 1;
68
+
7169 text_len = conf->get_next_block(consumed, &text, conf, state);
7270
7371 if (unlikely(text_len == 0))