Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Sep 2017 16:21:11 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@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: r323548 - in stable/11/lib/libc: gen locale
Message-ID:  <201709131621.v8DGLBfi003647@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Wed Sep 13 16:21:11 2017
New Revision: 323548
URL: https://svnweb.freebsd.org/changeset/base/323548

Log:
  MFC r322925:
  libc: minor indent(1) cleanups.
  
  Illumos and Schillix are adopting some of the locale code and our style(9)
  sometimes matches the Solaris cstyle, so the changes are also useful as a
  way to reduce diffs.
  
  No functional change.

Modified:
  stable/11/lib/libc/gen/fnmatch.c
  stable/11/lib/libc/locale/setlocale.c
  stable/11/lib/libc/locale/setrunelocale.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/gen/fnmatch.c
==============================================================================
--- stable/11/lib/libc/gen/fnmatch.c	Wed Sep 13 16:13:14 2017	(r323547)
+++ stable/11/lib/libc/gen/fnmatch.c	Wed Sep 13 16:21:11 2017	(r323548)
@@ -249,7 +249,7 @@ rangematch(const char *pattern, wchar_t test, int flag
 	 * consistency with the regular expression syntax.
 	 * J.T. Conklin (conklin@ngai.kaleida.com)
 	 */
-	if ( (negate = (*pattern == '!' || *pattern == '^')) )
+	if ((negate = (*pattern == '!' || *pattern == '^')))
 		++pattern;
 
 	if (flags & FNM_CASEFOLD)

Modified: stable/11/lib/libc/locale/setlocale.c
==============================================================================
--- stable/11/lib/libc/locale/setlocale.c	Wed Sep 13 16:13:14 2017	(r323547)
+++ stable/11/lib/libc/locale/setlocale.c	Wed Sep 13 16:21:11 2017	(r323548)
@@ -42,48 +42,48 @@ __FBSDID("$FreeBSD$");
 #include <errno.h>
 #include <limits.h>
 #include <locale.h>
-#include <paths.h>	/* for _PATH_LOCALE */
+#include <paths.h>			/* for _PATH_LOCALE */
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 #include "collate.h"
-#include "lmonetary.h"	/* for __monetary_load_locale() */
-#include "lnumeric.h"	/* for __numeric_load_locale() */
-#include "lmessages.h"	/* for __messages_load_locale() */
+#include "lmonetary.h"			/* for __monetary_load_locale() */
+#include "lnumeric.h"			/* for __numeric_load_locale() */
+#include "lmessages.h"			/* for __messages_load_locale() */
 #include "setlocale.h"
 #include "ldpart.h"
-#include "../stdtime/timelocal.h" /* for __time_load_locale() */
+#include "../stdtime/timelocal.h"	/* for __time_load_locale() */
 
 /*
  * Category names for getenv()
  */
 static const char categories[_LC_LAST][12] = {
-    "LC_ALL",
-    "LC_COLLATE",
-    "LC_CTYPE",
-    "LC_MONETARY",
-    "LC_NUMERIC",
-    "LC_TIME",
-    "LC_MESSAGES",
+	"LC_ALL",
+	"LC_COLLATE",
+	"LC_CTYPE",
+	"LC_MONETARY",
+	"LC_NUMERIC",
+	"LC_TIME",
+	"LC_MESSAGES",
 };
 
 /*
  * Current locales for each category
  */
 static char current_categories[_LC_LAST][ENCODING_LEN + 1] = {
-    "C",
-    "C",
-    "C",
-    "C",
-    "C",
-    "C",
-    "C",
+	"C",
+	"C",
+	"C",
+	"C",
+	"C",
+	"C",
+	"C",
 };
 
 /*
  * Path to locale storage directory
  */
-char	*_PathLocale;
+char   *_PathLocale;
 
 /*
  * The locales we are going to try and load
@@ -93,21 +93,20 @@ static char saved_categories[_LC_LAST][ENCODING_LEN + 
 
 static char current_locale_string[_LC_LAST * (ENCODING_LEN + 1/*"/"*/ + 1)];
 
-static char	*currentlocale(void);
-static char	*loadlocale(int);
+static char *currentlocale(void);
+static char *loadlocale(int);
 const char *__get_locale_env(int);
 
 char *
 setlocale(int category, const char *locale)
 {
 	int i, j, len, saverr;
-        const char *env, *r;
+	const char *env, *r;
 
 	if (category < LC_ALL || category >= _LC_LAST) {
 		errno = EINVAL;
 		return (NULL);
 	}
-
 	if (locale == NULL)
 		return (category != LC_ALL ?
 		    current_categories[category] : currentlocale());
@@ -162,13 +161,13 @@ setlocale(int category, const char *locale)
 			}
 			do {
 				if (i == _LC_LAST)
-					break;  /* Too many slashes... */
+					break;	/* Too many slashes... */
 				if ((len = r - locale) > ENCODING_LEN) {
 					errno = EINVAL;
 					return (NULL);
 				}
 				(void)strlcpy(new_categories[i], locale,
-					      len + 1);
+				    len + 1);
 				i++;
 				while (*r == '/')
 					r++;
@@ -178,7 +177,7 @@ setlocale(int category, const char *locale)
 			} while (*locale);
 			while (i < _LC_LAST) {
 				(void)strcpy(new_categories[i],
-					     new_categories[i-1]);
+				    new_categories[i - 1]);
 				i++;
 			}
 		}
@@ -193,7 +192,7 @@ setlocale(int category, const char *locale)
 			saverr = errno;
 			for (j = 1; j < i; j++) {
 				(void)strcpy(new_categories[j],
-					     saved_categories[j]);
+				    saved_categories[j]);
 				if (loadlocale(j) == NULL) {
 					(void)strcpy(new_categories[j], "C");
 					(void)loadlocale(j);
@@ -218,7 +217,7 @@ currentlocale(void)
 			for (i = 2; i < _LC_LAST; ++i) {
 				(void)strcat(current_locale_string, "/");
 				(void)strcat(current_locale_string,
-					     current_categories[i]);
+				    current_categories[i]);
 			}
 			break;
 		}
@@ -230,16 +229,15 @@ loadlocale(int category)
 {
 	char *new = new_categories[category];
 	char *old = current_categories[category];
-	int (*func)(const char *);
+	int (*func) (const char *);
 	int saved_errno;
 
 	if ((new[0] == '.' &&
-	     (new[1] == '\0' || (new[1] == '.' && new[2] == '\0'))) ||
+	    (new[1] == '\0' || (new[1] == '.' && new[2] == '\0'))) ||
 	    strchr(new, '/') != NULL) {
 		errno = EINVAL;
 		return (NULL);
 	}
-
 	saved_errno = errno;
 	errno = __detect_path_locale();
 	if (errno != 0)
@@ -285,22 +283,22 @@ loadlocale(int category)
 const char *
 __get_locale_env(int category)
 {
-        const char *env;
+	const char *env;
 
-        /* 1. check LC_ALL. */
-        env = getenv(categories[0]);
+	/* 1. check LC_ALL. */
+	env = getenv(categories[0]);
 
-        /* 2. check LC_* */
+	/* 2. check LC_* */
 	if (env == NULL || !*env)
-                env = getenv(categories[category]);
+		env = getenv(categories[category]);
 
-        /* 3. check LANG */
+	/* 3. check LANG */
 	if (env == NULL || !*env)
-                env = getenv("LANG");
+		env = getenv("LANG");
 
-        /* 4. if none is set, fall to "C" */
+	/* 4. if none is set, fall to "C" */
 	if (env == NULL || !*env)
-                env = "C";
+		env = "C";
 
 	return (env);
 }
@@ -326,4 +324,3 @@ __detect_path_locale(void)
 	}
 	return (0);
 }
-

Modified: stable/11/lib/libc/locale/setrunelocale.c
==============================================================================
--- stable/11/lib/libc/locale/setrunelocale.c	Wed Sep 13 16:13:14 2017	(r323547)
+++ stable/11/lib/libc/locale/setrunelocale.c	Wed Sep 13 16:21:11 2017	(r323548)
@@ -38,7 +38,7 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
-#define __RUNETYPE_INTERNAL 1
+#define	__RUNETYPE_INTERNAL 1
 
 #include <runetype.h>
 #include <errno.h>
@@ -72,7 +72,7 @@ destruct_ctype(void *v)
 {
 	struct xlocale_ctype *l = v;
 
-	if (&_DefaultRuneLocale != l->runes) 
+	if (&_DefaultRuneLocale != l->runes)
 		free(l->runes);
 	free(l);
 }
@@ -81,7 +81,7 @@ const _RuneLocale *
 __getCurrentRuneLocale(void)
 {
 
-	return XLOCALE_CTYPE(__get_locale())->runes;
+	return (XLOCALE_CTYPE(__get_locale())->runes);
 }
 
 static void
@@ -144,7 +144,7 @@ __setrunelocale(struct xlocale_ctype *l, const char *e
 	else if (strcmp(rl->__encoding, "EUC-TW") == 0)
 		ret = _EUC_TW_init(l, rl);
 	else if (strcmp(rl->__encoding, "GB18030") == 0)
- 		ret = _GB18030_init(l, rl);
+		ret = _GB18030_init(l, rl);
 	else if (strcmp(rl->__encoding, "GB2312") == 0)
 		ret = _GB2312_init(l, rl);
 	else if (strcmp(rl->__encoding, "GBK") == 0)
@@ -204,10 +204,9 @@ __ctype_load(const char *locale, locale_t unused __unu
 	struct xlocale_ctype *l = calloc(sizeof(struct xlocale_ctype), 1);
 
 	l->header.header.destructor = destruct_ctype;
-	if (__setrunelocale(l, locale))
-	{
+	if (__setrunelocale(l, locale)) {
 		free(l);
-		return NULL;
+		return (NULL);
 	}
-	return l;
+	return (l);
 }



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