summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
authorkan <kan@FreeBSD.org>2003-04-30 19:05:53 +0000
committerkan <kan@FreeBSD.org>2003-04-30 19:05:53 +0000
commit75fd435e27c35ac151ded91ff1d35e3cf27fc121 (patch)
treef930084bf9c3313b8b2562dee0ed217ddfafff81 /libexec
parent8013c78d4fdb709008cef8240de51a1f8d4cb9f9 (diff)
downloadFreeBSD-src-75fd435e27c35ac151ded91ff1d35e3cf27fc121.zip
FreeBSD-src-75fd435e27c35ac151ded91ff1d35e3cf27fc121.tar.gz
Remove redundant strlen checks, do not check the same
symbol twice.
Diffstat (limited to 'libexec')
-rw-r--r--libexec/rtld-elf/libmap.c47
1 files changed, 24 insertions, 23 deletions
diff --git a/libexec/rtld-elf/libmap.c b/libexec/rtld-elf/libmap.c
index dcfc317..c23289c 100644
--- a/libexec/rtld-elf/libmap.c
+++ b/libexec/rtld-elf/libmap.c
@@ -59,7 +59,7 @@ lm_init (void)
while (isspace(*cp)) cp++;
/* Found a comment or EOL */
- if (iseol(*cp)) goto next;
+ if (iseol(*cp)) continue;
/* Found a constraint selector */
if (*cp == '[') {
@@ -69,17 +69,19 @@ lm_init (void)
while (isspace(*cp)) cp++;
/* Found comment, EOL or end of selector */
- if (iseol(*cp) || *cp == ']') goto next;
+ if (iseol(*cp) || *cp == ']')
+ continue;
- p = cp;
+ p = cp++;
/* Skip to end of word */
- while (!isspace(*cp) && !iseol(*cp) && *cp != ']') cp++;
+ while (!isspace(*cp) && !iseol(*cp) && *cp != ']')
+ cp++;
/* Skip and zero out trailing space */
while (isspace(*cp)) *cp++ = '\0';
/* Check if there is a closing brace */
- if (*cp != ']') goto next;
+ if (*cp != ']') continue;
/* Terminate string if there was no trailing space */
*cp++ = '\0';
@@ -89,38 +91,37 @@ lm_init (void)
* from this point to the end of the line.
*/
while(isspace(*cp++));
- if (*cp != '\0' && *cp != '#') goto next;
-
- if (strlen(p) > 0) {
- bzero(prog, MAXPATHLEN);
- strncpy(prog, p, strlen(p));
- p = prog;
- }
- goto next;
+ if (!iseol(*cp)) continue;
+
+ strcpy(prog, p);
+ p = prog;
+ continue;
}
/* Parse the 'from' candidate. */
- f = cp;
+ f = cp++;
while (!isspace(*cp) && !iseol(*cp)) cp++;
- *cp++ = '\0';
/* Skip and zero out the trailing whitespace */
while (isspace(*cp)) *cp++ = '\0';
/* Found a comment or EOL */
- if (iseol(*cp)) goto next;
+ if (iseol(*cp)) continue;
/* Parse 'to' mapping */
- t = cp;
+ t = cp++;
while (!isspace(*cp) && !iseol(*cp)) cp++;
- *cp++ = '\0';
+
+ /* Skip and zero out the trailing whitespace */
+ while (isspace(*cp)) *cp++ = '\0';
+
+ /* Should be no extra tokens at this point */
+ if (!iseol(*cp)) continue;
- if ((strlen(f) > 0) && (strlen(t) > 0))
- lm_add(p, strdup(f), strdup(t));
-next:
- bzero(line, sizeof(line));
+ *cp = '\0';
+ lm_add(p, strdup(f), strdup(t));
}
- (void)fclose(fp);
+ fclose(fp);
return;
}
OpenPOWER on IntegriCloud