Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 33448
b: refs/heads/master
c: 3ffaa8c
h: refs/heads/master
v: v3
  • Loading branch information
Michael Rash authored and David S. Miller committed Aug 22, 2006
1 parent 0618b3c commit a6ad8ef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 316c1592bea94ead75301cb764523661fbbcc1ca
refs/heads/master: 3ffaa8c7c0f884171a273cd2145b8fbbf233ba22
11 changes: 5 additions & 6 deletions trunk/lib/ts_bm.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,14 @@ static int subpattern(u8 *pattern, int i, int j, int g)
return ret;
}

static void compute_prefix_tbl(struct ts_bm *bm, const u8 *pattern,
unsigned int len)
static void compute_prefix_tbl(struct ts_bm *bm)
{
int i, j, g;

for (i = 0; i < ASIZE; i++)
bm->bad_shift[i] = len;
for (i = 0; i < len - 1; i++)
bm->bad_shift[pattern[i]] = len - 1 - i;
bm->bad_shift[i] = bm->patlen;
for (i = 0; i < bm->patlen - 1; i++)
bm->bad_shift[bm->pattern[i]] = bm->patlen - 1 - i;

/* Compute the good shift array, used to match reocurrences
* of a subpattern */
Expand Down Expand Up @@ -150,8 +149,8 @@ static struct ts_config *bm_init(const void *pattern, unsigned int len,
bm = ts_config_priv(conf);
bm->patlen = len;
bm->pattern = (u8 *) bm->good_shift + prefix_tbl_len;
compute_prefix_tbl(bm, pattern, len);
memcpy(bm->pattern, pattern, len);
compute_prefix_tbl(bm);

return conf;
}
Expand Down

0 comments on commit a6ad8ef

Please sign in to comment.