Pretty sure this was optimized out anyways, but this is cleaner IMO.
| ... | ... |
@@ -46,9 +46,8 @@ struct match_struct {
|
| 46 | 46 |
|
| 47 | 47 |
static void precompute_bonus(const char *haystack, score_t *match_bonus) {
|
| 48 | 48 |
/* Which positions are beginning of words */ |
| 49 |
- int m = strlen(haystack); |
|
| 50 | 49 |
char last_ch = '/'; |
| 51 |
- for (int i = 0; i < m; i++) {
|
|
| 50 |
+ for (int i = 0; haystack[i]; i++) {
|
|
| 52 | 51 |
char ch = haystack[i]; |
| 53 | 52 |
match_bonus[i] = COMPUTE_BONUS(last_ch, ch); |
| 54 | 53 |
last_ch = ch; |