aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-12-26 20:56:55 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-12-26 20:56:55 +0000
commitc03e8721128fa7803d40dd07084f7650e88c7355 (patch)
treec13760bac677e9d4220477c0ac29ed9c2a52c1a4 /networking/udhcp
parentabee3d0e0dc7c7e4b733b0145c56bf8159a37a69 (diff)
downloadbusybox-c03e8721128fa7803d40dd07084f7650e88c7355.tar.gz
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')
-rw-r--r--networking/udhcp/files.c10
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)
while (fgets(buffer, READ_CONFIG_BUF_SIZE, in)) {
char debug_orig[READ_CONFIG_BUF_SIZE];
- char *p;
lm++;
- p = strchr(buffer, '\n');
- if (p) *p = '\0';
- if (ENABLE_FEATURE_UDHCP_DEBUG) strcpy(debug_orig, buffer);
- p = strchr(buffer, '#');
- if (p) *p = '\0';
+ *strchrnul(buffer, '\n') = '\0';
+ if (ENABLE_FEATURE_UDHCP_DEBUG)
+ strcpy(debug_orig, buffer);
+ *strchrnul(buffer, '#') = '\0';
token = strtok(buffer, " \t");
if (!token) continue;