From owner-svn-src-all@freebsd.org Sun Sep 2 15:42:38 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C03EAFF2891; Sun, 2 Sep 2018 15:42:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 793BC7D25A; Sun, 2 Sep 2018 15:42:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 743211B49B; Sun, 2 Sep 2018 15:42:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w82Fgb0K064455; Sun, 2 Sep 2018 15:42:37 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w82FgbKD064454; Sun, 2 Sep 2018 15:42:37 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201809021542.w82FgbKD064454@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 2 Sep 2018 15:42:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338428 - head/libexec/rtld-elf X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/libexec/rtld-elf X-SVN-Commit-Revision: 338428 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Sep 2018 15:42:38 -0000 Author: kib Date: Sun Sep 2 15:42:37 2018 New Revision: 338428 URL: https://svnweb.freebsd.org/changeset/base/338428 Log: Style cleanup. No functional changes. Sponsored by: The FreeBSD Foundation MFC after: 3 days Approved by: re (rgrimes) Modified: head/libexec/rtld-elf/libmap.c Modified: head/libexec/rtld-elf/libmap.c ============================================================================== --- head/libexec/rtld-elf/libmap.c Sun Sep 2 10:51:31 2018 (r338427) +++ head/libexec/rtld-elf/libmap.c Sun Sep 2 15:42:37 2018 (r338428) @@ -99,10 +99,10 @@ static void lmc_parse_file(char *path) { struct lmc *p; + char *lm_map; struct stat st; ssize_t retval; int fd; - char *lm_map; TAILQ_FOREACH(p, &lmc_head, next) { if (strcmp(p->path, path) == 0) @@ -222,17 +222,20 @@ lmc_parse(char *lm_p, size_t lm_len) t = f = c = NULL; /* Skip over leading space */ - while (rtld_isspace(*cp)) cp++; + while (rtld_isspace(*cp)) + cp++; /* Found a comment or EOL */ - if (iseol(*cp)) continue; + if (iseol(*cp)) + continue; /* Found a constraint selector */ if (*cp == '[') { cp++; /* Skip leading space */ - while (rtld_isspace(*cp)) cp++; + while (rtld_isspace(*cp)) + cp++; /* Found comment, EOL or end of selector */ if (iseol(*cp) || *cp == ']') @@ -244,10 +247,12 @@ lmc_parse(char *lm_p, size_t lm_len) cp++; /* Skip and zero out trailing space */ - while (rtld_isspace(*cp)) *cp++ = '\0'; + while (rtld_isspace(*cp)) + *cp++ = '\0'; /* Check if there is a closing brace */ - if (*cp != ']') continue; + if (*cp != ']') + continue; /* Terminate string if there was no trailing space */ *cp++ = '\0'; @@ -256,8 +261,10 @@ lmc_parse(char *lm_p, size_t lm_len) * There should be nothing except whitespace or comment from this point to the end of the line. */ - while(rtld_isspace(*cp)) cp++; - if (!iseol(*cp)) continue; + while (rtld_isspace(*cp)) + cp++; + if (!iseol(*cp)) + continue; if (strlcpy(prog, c, sizeof prog) >= sizeof prog) continue; @@ -267,23 +274,29 @@ lmc_parse(char *lm_p, size_t lm_len) /* Parse the 'from' candidate. */ f = cp++; - while (!rtld_isspace(*cp) && !iseol(*cp)) cp++; + while (!rtld_isspace(*cp) && !iseol(*cp)) + cp++; /* Skip and zero out the trailing whitespace */ - while (rtld_isspace(*cp)) *cp++ = '\0'; + while (rtld_isspace(*cp)) + *cp++ = '\0'; /* Found a comment or EOL */ - if (iseol(*cp)) continue; + if (iseol(*cp)) + continue; /* Parse 'to' mapping */ t = cp++; - while (!rtld_isspace(*cp) && !iseol(*cp)) cp++; + while (!rtld_isspace(*cp) && !iseol(*cp)) + cp++; /* Skip and zero out the trailing whitespace */ - while (rtld_isspace(*cp)) *cp++ = '\0'; + while (rtld_isspace(*cp)) + *cp++ = '\0'; /* Should be no extra tokens at this point */ - if (!iseol(*cp)) continue; + if (!iseol(*cp)) + continue; *cp = '\0'; if (strcmp(f, "includedir") == 0) @@ -296,7 +309,7 @@ lmc_parse(char *lm_p, size_t lm_len) } static void -lm_free (struct lm_list *lml) +lm_free(struct lm_list *lml) { struct lm *lm; @@ -309,11 +322,10 @@ lm_free (struct lm_list *lml) free(lm->t); free(lm); } - return; } void -lm_fini (void) +lm_fini(void) { struct lmp *lmp; struct lmc *p; @@ -334,11 +346,10 @@ lm_fini (void) lm_free(&lmp->lml); free(lmp); } - return; } static void -lm_add (const char *p, const char *f, const char *t) +lm_add(const char *p, const char *f, const char *t) { struct lm_list *lml; struct lm *lm; @@ -359,7 +370,7 @@ lm_add (const char *p, const char *f, const char *t) } char * -lm_find (const char *p, const char *f) +lm_find(const char *p, const char *f) { struct lm_list *lml; char *t; @@ -380,14 +391,15 @@ lm_find (const char *p, const char *f) lml = lmp_find("$DEFAULT$"); if (lml != NULL) return (lml_find(lml, f)); - else - return (NULL); + return (NULL); } -/* Given a libmap translation list and a library name, return the - replacement library, or NULL */ +/* + * Given a libmap translation list and a library name, return the + * replacement library, or NULL. + */ char * -lm_findn (const char *p, const char *f, const int n) +lm_findn(const char *p, const char *f, const int n) { char pathbuf[64], *s, *t; @@ -404,37 +416,43 @@ lm_findn (const char *p, const char *f, const int n) } static char * -lml_find (struct lm_list *lmh, const char *f) +lml_find(struct lm_list *lmh, const char *f) { struct lm *lm; dbg("%s(%p, \"%s\")", __func__, lmh, f); - TAILQ_FOREACH(lm, lmh, lm_link) + TAILQ_FOREACH(lm, lmh, lm_link) { if (strcmp(f, lm->f) == 0) return (lm->t); + } return (NULL); } -/* Given an executable name, return a pointer to the translation list or - NULL if no matches */ +/* + * Given an executable name, return a pointer to the translation list or + * NULL if no matches. + */ static struct lm_list * -lmp_find (const char *n) +lmp_find(const char *n) { struct lmp *lmp; dbg("%s(\"%s\")", __func__, n); - TAILQ_FOREACH(lmp, &lmp_head, lmp_link) + TAILQ_FOREACH(lmp, &lmp_head, lmp_link) { if ((lmp->type == T_EXACT && strcmp(n, lmp->p) == 0) || - (lmp->type == T_DIRECTORY && strncmp(n, lmp->p, strlen(lmp->p)) == 0) || - (lmp->type == T_BASENAME && strcmp(quickbasename(n), lmp->p) == 0)) + (lmp->type == T_DIRECTORY && strncmp(n, lmp->p, + strlen(lmp->p)) == 0) || + (lmp->type == T_BASENAME && strcmp(quickbasename(n), + lmp->p) == 0)) return (&lmp->lml); + } return (NULL); } static struct lm_list * -lmp_init (char *n) +lmp_init(char *n) { struct lmp *lmp; @@ -442,7 +460,7 @@ lmp_init (char *n) lmp = xmalloc(sizeof(struct lmp)); lmp->p = n; - if (n[strlen(n)-1] == '/') + if (n[strlen(n) - 1] == '/') lmp->type = T_DIRECTORY; else if (strchr(n,'/') == NULL) lmp->type = T_BASENAME; @@ -454,15 +472,18 @@ lmp_init (char *n) return (&lmp->lml); } -/* libc basename is overkill. Return a pointer to the character after the - last /, or the original string if there are no slashes. */ +/* + * libc basename is overkill. Return a pointer to the character after + * the last /, or the original string if there are no slashes. + */ static const char * -quickbasename (const char *path) +quickbasename(const char *path) { - const char *p = path; - for (; *path; path++) { + const char *p; + + for (p = path; *path != '\0'; path++) { if (*path == '/') - p = path+1; + p = path + 1; } return (p); }