Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Sep 2018 21:24:26 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r338483 - stable/11/libexec/rtld-elf
Message-ID:  <201809052124.w85LOQYT079678@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Wed Sep  5 21:24:26 2018
New Revision: 338483
URL: https://svnweb.freebsd.org/changeset/base/338483

Log:
  MFC r338428:
  Style cleanup.

Modified:
  stable/11/libexec/rtld-elf/libmap.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/libexec/rtld-elf/libmap.c
==============================================================================
--- stable/11/libexec/rtld-elf/libmap.c	Wed Sep  5 21:23:40 2018	(r338482)
+++ stable/11/libexec/rtld-elf/libmap.c	Wed Sep  5 21:24:26 2018	(r338483)
@@ -99,9 +99,9 @@ static void
 lmc_parse_file(char *path)
 {
 	struct lmc *p;
+	char *lm_map;
 	struct stat st;
 	int fd;
-	char *lm_map;
 
 	TAILQ_FOREACH(p, &lmc_head, next) {
 		if (strcmp(p->path, path) == 0)
@@ -219,17 +219,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 == ']')
@@ -241,10 +244,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';
@@ -253,8 +258,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;
@@ -264,23 +271,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)
@@ -293,7 +306,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;
 
@@ -306,11 +319,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;
@@ -331,11 +343,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;
@@ -356,7 +367,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;
@@ -377,14 +388,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;
 
@@ -401,37 +413,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;
 
@@ -439,7 +457,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;
@@ -451,15 +469,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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201809052124.w85LOQYT079678>