diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/libc/string/strstr.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/lib/libc/string/strstr.c b/src/lib/libc/string/strstr.c index 079d69d257..241a080e7a 100644 --- a/src/lib/libc/string/strstr.c +++ b/src/lib/libc/string/strstr.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* $OpenBSD: strstr.c,v 1.8 2018/04/30 07:44:56 denis Exp $ */ | 1 | /* $OpenBSD: strstr.c,v 1.9 2020/04/16 12:37:52 claudio Exp $ */ |
| 2 | 2 | ||
| 3 | /* | 3 | /* |
| 4 | * Copyright (c) 2005-2014 Rich Felker | 4 | * Copyright (c) 2005-2018 Rich Felker |
| 5 | * | 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining | 6 | * Permission is hereby granted, free of charge, to any person obtaining |
| 7 | * a copy of this software and associated documentation files (the | 7 | * a copy of this software and associated documentation files (the |
| @@ -24,13 +24,8 @@ | |||
| 24 | */ | 24 | */ |
| 25 | 25 | ||
| 26 | #include <string.h> | 26 | #include <string.h> |
| 27 | #include <stdlib.h> | ||
| 28 | #include <stdint.h> | 27 | #include <stdint.h> |
| 29 | 28 | ||
| 30 | #ifdef DEBUG | ||
| 31 | #include <stdio.h> | ||
| 32 | #endif | ||
| 33 | |||
| 34 | static char * | 29 | static char * |
| 35 | twobyte_strstr(const unsigned char *h, const unsigned char *n) | 30 | twobyte_strstr(const unsigned char *h, const unsigned char *n) |
| 36 | { | 31 | { |
| @@ -146,11 +141,8 @@ twoway_strstr(const unsigned char *h, const unsigned char *n) | |||
| 146 | /* Check last byte first; advance by shift on mismatch */ | 141 | /* Check last byte first; advance by shift on mismatch */ |
| 147 | if (BITOP(byteset, h[l-1], &)) { | 142 | if (BITOP(byteset, h[l-1], &)) { |
| 148 | k = l-shift[h[l-1]]; | 143 | k = l-shift[h[l-1]]; |
| 149 | #ifdef DEBUG | ||
| 150 | printf("adv by %zu (on %c) at [%s] (%zu;l=%zu)\n", k, h[l-1], h, shift[h[l-1]], l); | ||
| 151 | #endif | ||
| 152 | if (k) { | 144 | if (k) { |
| 153 | if (mem0 && mem && k < p) k = l-p; | 145 | if (k < mem) k = mem; |
| 154 | h += k; | 146 | h += k; |
| 155 | mem = 0; | 147 | mem = 0; |
| 156 | continue; | 148 | continue; |
