diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-12-30 19:52:28 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-12-30 19:52:28 +0000 |
commit | 80602a98bcc3100279e09e1291d47a0adb6addb1 (patch) | |
tree | 7eaed9db7ac11303e1a97ae4e2d2daf2d3860f75 /scripts/basic/fixdep.c | |
parent | 1b3e8179a299f3f947e21b9e44e824da89ad1d5a (diff) | |
download | busybox-w32-80602a98bcc3100279e09e1291d47a0adb6addb1.tar.gz busybox-w32-80602a98bcc3100279e09e1291d47a0adb6addb1.tar.bz2 busybox-w32-80602a98bcc3100279e09e1291d47a0adb6addb1.zip |
saw commit of vapier@busybox.net (thanks!),
decided to stop doing FOUR memcmp's per each input character.
I should have fixed this much earlier...
Diffstat (limited to 'scripts/basic/fixdep.c')
-rw-r--r-- | scripts/basic/fixdep.c | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index 2fa78ee6a..65bae4dac 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c | |||
@@ -225,31 +225,36 @@ void use_config(char *m, int slen) | |||
225 | void parse_config_file(char *map, size_t len) | 225 | void parse_config_file(char *map, size_t len) |
226 | { | 226 | { |
227 | /* modified for bbox */ | 227 | /* modified for bbox */ |
228 | char *end = map + len; | 228 | char *end_4 = map + len - 4; /* 4 == length of "USE_" */ |
229 | char *end_7 = map + len - 7; | ||
229 | char *p = map; | 230 | char *p = map; |
230 | char *q; | 231 | char *q; |
231 | int off; | 232 | int off; |
232 | 233 | ||
233 | for (; p < end; p++) { | 234 | for (; p < end_4; p++) { |
234 | if (p<end-7 && !memcmp(p, "CONFIG_", 7)) goto conf7; | 235 | if (p < end_7 && p[6] == '_') { |
235 | if (p<end-7 && !memcmp(p, "ENABLE_", 7)) goto conf7; | 236 | if (!memcmp(p, "CONFIG", 6)) goto conf7; |
236 | if (p<end-4 && !memcmp(p, "USE_", 4)) goto conf4; | 237 | if (!memcmp(p, "ENABLE", 6)) goto conf7; |
237 | if (p<end-5 && !memcmp(p, "SKIP_", 5)) goto conf5; | 238 | } |
239 | /* We have at least 5 chars: for() has | ||
240 | * "p < end-4", not "p <= end-4" | ||
241 | * therefore we don't need to check p <= end-5 here */ | ||
242 | if (p[4] == '_') { | ||
243 | if (!memcmp(p, "SKIP", 4)) goto conf5; | ||
244 | } | ||
245 | /* Ehhh, gcc is too stupid to just compare it as 32bit int */ | ||
246 | if (!memcmp(p, "USE_", 4)) goto conf4; | ||
238 | continue; | 247 | continue; |
239 | conf4: off = 4; goto conf; | 248 | |
240 | conf5: off = 5; goto conf; | 249 | conf4: off = 4; |
250 | conf5: off = 5; | ||
241 | conf7: off = 7; | 251 | conf7: off = 7; |
242 | conf: | 252 | p += off; |
243 | if (p > map + len - off) | 253 | for (q = p; q < end_4+4; q++) { |
244 | continue; | ||
245 | for (q = p + off; q < map + len; q++) { | ||
246 | if (!(isalnum(*q) || *q == '_')) | 254 | if (!(isalnum(*q) || *q == '_')) |
247 | goto found; | 255 | break; |
248 | } | 256 | } |
249 | continue; | 257 | use_config(p, q-p); |
250 | |||
251 | found: | ||
252 | use_config(p+off, q-p-off); | ||
253 | } | 258 | } |
254 | } | 259 | } |
255 | 260 | ||