aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-10-22 19:42:26 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-10-22 19:42:26 +0200
commit6935ec9c0b2ac58b1ddc206c21bea36582e1f233 (patch)
tree50ffa8f359c7eb8830f5e0b512954e87071978ac /networking
parentf125b6d341b06fda5412b82d23e486100e107eaa (diff)
downloadbusybox-6935ec9c0b2ac58b1ddc206c21bea36582e1f233.tar.gz
networking/interface.c: tiny code shrink
function old new delta if_readlist_proc 634 631 -3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking')
-rw-r--r--networking/interface.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/networking/interface.c b/networking/interface.c
index ef187be1a..fe6b23dbc 100644
--- a/networking/interface.c
+++ b/networking/interface.c
@@ -410,20 +410,20 @@ static struct interface *add_interface(char *name)
static char *get_name(char *name, char *p)
{
/* Extract <name> from nul-terminated p where p matches
- <name>: after leading whitespace.
- If match is not made, set name empty and return unchanged p */
- int namestart = 0, nameend = 0;
+ * <name>: after leading whitespace.
+ * If match is not made, set name empty and return unchanged p
+ */
+ char *nameend;
+ char *namestart = skip_whitespace(p);
- while (isspace(p[namestart]))
- namestart++;
nameend = namestart;
- while (p[nameend] && p[nameend] != ':' && !isspace(p[nameend]))
+ while (*nameend && *nameend != ':' && !isspace(*nameend))
nameend++;
- if (p[nameend] == ':') {
+ if (*nameend == ':') {
if ((nameend - namestart) < IFNAMSIZ) {
- memcpy(name, &p[namestart], nameend - namestart);
+ memcpy(name, namestart, nameend - namestart);
name[nameend - namestart] = '\0';
- p = &p[nameend];
+ p = nameend;
} else {
/* Interface name too large */
name[0] = '\0';