diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-12-26 20:56:55 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-12-26 20:56:55 +0000 |
commit | c03e8721128fa7803d40dd07084f7650e88c7355 (patch) | |
tree | c13760bac677e9d4220477c0ac29ed9c2a52c1a4 /networking/udhcp/files.c | |
parent | abee3d0e0dc7c7e4b733b0145c56bf8159a37a69 (diff) | |
download | busybox-w32-c03e8721128fa7803d40dd07084f7650e88c7355.tar.gz busybox-w32-c03e8721128fa7803d40dd07084f7650e88c7355.tar.bz2 busybox-w32-c03e8721128fa7803d40dd07084f7650e88c7355.zip |
save a bit of code with *strchrnul = '\0' trick
function old new delta
nextline 59 55 -4
include_conf 902 898 -4
read_config 414 406 -8
fsck_main 1880 1869 -11
Diffstat (limited to 'networking/udhcp/files.c')
-rw-r--r-- | networking/udhcp/files.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/networking/udhcp/files.c b/networking/udhcp/files.c index 63c90647d..491b8871e 100644 --- a/networking/udhcp/files.c +++ b/networking/udhcp/files.c | |||
@@ -332,14 +332,12 @@ int read_config(const char *file) | |||
332 | 332 | ||
333 | while (fgets(buffer, READ_CONFIG_BUF_SIZE, in)) { | 333 | while (fgets(buffer, READ_CONFIG_BUF_SIZE, in)) { |
334 | char debug_orig[READ_CONFIG_BUF_SIZE]; | 334 | char debug_orig[READ_CONFIG_BUF_SIZE]; |
335 | char *p; | ||
336 | 335 | ||
337 | lm++; | 336 | lm++; |
338 | p = strchr(buffer, '\n'); | 337 | *strchrnul(buffer, '\n') = '\0'; |
339 | if (p) *p = '\0'; | 338 | if (ENABLE_FEATURE_UDHCP_DEBUG) |
340 | if (ENABLE_FEATURE_UDHCP_DEBUG) strcpy(debug_orig, buffer); | 339 | strcpy(debug_orig, buffer); |
341 | p = strchr(buffer, '#'); | 340 | *strchrnul(buffer, '#') = '\0'; |
342 | if (p) *p = '\0'; | ||
343 | 341 | ||
344 | token = strtok(buffer, " \t"); | 342 | token = strtok(buffer, " \t"); |
345 | if (!token) continue; | 343 | if (!token) continue; |