aboutsummaryrefslogtreecommitdiff
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
parentf125b6d341b06fda5412b82d23e486100e107eaa (diff)
downloadbusybox-w32-6935ec9c0b2ac58b1ddc206c21bea36582e1f233.tar.gz
busybox-w32-6935ec9c0b2ac58b1ddc206c21bea36582e1f233.tar.bz2
busybox-w32-6935ec9c0b2ac58b1ddc206c21bea36582e1f233.zip
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>
-rw-r--r--editors/sed.c6
-rw-r--r--networking/interface.c18
2 files changed, 12 insertions, 12 deletions
diff --git a/editors/sed.c b/editors/sed.c
index e7b2c214a..9b360b669 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -359,7 +359,8 @@ static int parse_subst_cmd(sed_cmd_t *sed_cmd, const char *substr)
359 continue; 359 continue;
360 } 360 }
361 /* Skip spaces */ 361 /* Skip spaces */
362 if (isspace(substr[idx])) continue; 362 if (isspace(substr[idx]))
363 continue;
363 364
364 switch (substr[idx]) { 365 switch (substr[idx]) {
365 /* Replace all occurrences */ 366 /* Replace all occurrences */
@@ -417,8 +418,7 @@ static const char *parse_cmd_args(sed_cmd_t *sed_cmd, const char *cmdstr)
417 /* handle edit cmds: (a)ppend, (i)nsert, and (c)hange */ 418 /* handle edit cmds: (a)ppend, (i)nsert, and (c)hange */
418 else if (strchr("aic", sed_cmd->cmd)) { 419 else if (strchr("aic", sed_cmd->cmd)) {
419 if ((sed_cmd->end_line || sed_cmd->end_match) && sed_cmd->cmd != 'c') 420 if ((sed_cmd->end_line || sed_cmd->end_match) && sed_cmd->cmd != 'c')
420 bb_error_msg_and_die 421 bb_error_msg_and_die("only a beginning address can be specified for edit commands");
421 ("only a beginning address can be specified for edit commands");
422 for (;;) { 422 for (;;) {
423 if (*cmdstr == '\n' || *cmdstr == '\\') { 423 if (*cmdstr == '\n' || *cmdstr == '\\') {
424 cmdstr++; 424 cmdstr++;
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)
410static char *get_name(char *name, char *p) 410static char *get_name(char *name, char *p)
411{ 411{
412 /* Extract <name> from nul-terminated p where p matches 412 /* Extract <name> from nul-terminated p where p matches
413 <name>: after leading whitespace. 413 * <name>: after leading whitespace.
414 If match is not made, set name empty and return unchanged p */ 414 * If match is not made, set name empty and return unchanged p
415 int namestart = 0, nameend = 0; 415 */
416 char *nameend;
417 char *namestart = skip_whitespace(p);
416 418
417 while (isspace(p[namestart]))
418 namestart++;
419 nameend = namestart; 419 nameend = namestart;
420 while (p[nameend] && p[nameend] != ':' && !isspace(p[nameend])) 420 while (*nameend && *nameend != ':' && !isspace(*nameend))
421 nameend++; 421 nameend++;
422 if (p[nameend] == ':') { 422 if (*nameend == ':') {
423 if ((nameend - namestart) < IFNAMSIZ) { 423 if ((nameend - namestart) < IFNAMSIZ) {
424 memcpy(name, &p[namestart], nameend - namestart); 424 memcpy(name, namestart, nameend - namestart);
425 name[nameend - namestart] = '\0'; 425 name[nameend - namestart] = '\0';
426 p = &p[nameend]; 426 p = nameend;
427 } else { 427 } else {
428 /* Interface name too large */ 428 /* Interface name too large */
429 name[0] = '\0'; 429 name[0] = '\0';