summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2002-08-07 16:45:23 +0000
committerache <ache@FreeBSD.org>2002-08-07 16:45:23 +0000
commit5695ea6363a2eab6ca0fe05e683eddad7ade75ca (patch)
treefd1099310bb3054db75e0b388dc5bdcff3c468f9 /lib
parent2573e2eec1684106b501be3367ecd8f50679ee50 (diff)
downloadFreeBSD-src-5695ea6363a2eab6ca0fe05e683eddad7ade75ca.zip
FreeBSD-src-5695ea6363a2eab6ca0fe05e683eddad7ade75ca.tar.gz
Style fixes in preparation of code rewritting
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/locale/ldpart.c42
-rw-r--r--lib/libc/locale/lmessages.c8
-rw-r--r--lib/libc/locale/lmonetary.c17
-rw-r--r--lib/libc/locale/lnumeric.c10
4 files changed, 43 insertions, 34 deletions
diff --git a/lib/libc/locale/ldpart.c b/lib/libc/locale/ldpart.c
index e6558ca..0e276cf 100644
--- a/lib/libc/locale/ldpart.c
+++ b/lib/libc/locale/ldpart.c
@@ -53,18 +53,18 @@ __part_load_locale(const char *name,
int locale_buf_size_min,
const char **dst_localebuf)
{
- static char locale_buf_C[] = "C";
- static int num_lines;
- int saverr;
- int fd;
- char *lbuf;
- char *p;
- const char *plim;
- char filename[PATH_MAX];
- struct stat st;
- size_t namesize;
- size_t bufsize;
- int save_using_locale;
+ static char locale_buf_C[] = "C";
+ static int num_lines;
+ int saverr;
+ int fd;
+ char *lbuf;
+ char *p;
+ const char *plim;
+ char filename[PATH_MAX];
+ struct stat st;
+ size_t namesize;
+ size_t bufsize;
+ int save_using_locale;
save_using_locale = *using_locale;
*using_locale = 0;
@@ -112,7 +112,7 @@ __part_load_locale(const char *name,
malloc(bufsize) : reallocf(lbuf, bufsize);
if (lbuf == NULL)
goto bad_locale;
- (void) strcpy(lbuf, name);
+ (void)strcpy(lbuf, name);
p = lbuf + namesize;
plim = p + st.st_size;
if (_read(fd, p, (size_t) st.st_size) != st.st_size)
@@ -142,30 +142,36 @@ __part_load_locale(const char *name,
locale_buf = lbuf;
*using_locale = 1;
+
return 0;
reset_locale:
locale_buf = locale_buf_C;
save_using_locale = 0;
bad_lbuf:
- saverr = errno; free(lbuf); errno = saverr;
+ saverr = errno;
+ free(lbuf);
+ errno = saverr;
bad_locale:
- saverr = errno; (void)_close(fd); errno = saverr;
+ saverr = errno;
+ (void)_close(fd);
+ errno = saverr;
no_locale:
*using_locale = save_using_locale;
+
return -1;
}
static int
-split_lines(char *p, const char *plim) {
-
+split_lines(char *p, const char *plim)
+{
int i;
for (i = 0; p < plim; i++) {
p = strchr(p, '\n');
*p++ = '\0';
}
- return i;
+ return (i);
}
static void
diff --git a/lib/libc/locale/lmessages.c b/lib/libc/locale/lmessages.c
index 8b826f7..dd1239e 100644
--- a/lib/libc/locale/lmessages.c
+++ b/lib/libc/locale/lmessages.c
@@ -50,8 +50,8 @@ static int _messages_using_locale;
static char *_messages_locale_buf;
int
-__messages_load_locale(const char *name) {
-
+__messages_load_locale(const char *name)
+{
/*
* Propose that we can have incomplete locale file (w/o "{yes,no}str").
* Initialize them before loading. In case of complete locale, they'll
@@ -67,8 +67,8 @@ __messages_load_locale(const char *name) {
}
struct lc_messages_T *
-__get_current_messages_locale(void) {
-
+__get_current_messages_locale(void)
+{
return (_messages_using_locale
? &_messages_locale
: (struct lc_messages_T *)&_C_messages_locale);
diff --git a/lib/libc/locale/lmonetary.c b/lib/libc/locale/lmonetary.c
index 2f16e7c..eddd1ce 100644
--- a/lib/libc/locale/lmonetary.c
+++ b/lib/libc/locale/lmonetary.c
@@ -63,17 +63,20 @@ static int _monetary_using_locale;
static char *_monetary_locale_buf;
static char
-cnv(const char *str) {
+cnv(const char *str)
+{
int i = strtol(str, NULL, 10);
+
if (i == -1)
i = CHAR_MAX;
- return (char)i;
+ return ((char)i);
}
int
-__monetary_load_locale(const char *name) {
-
+__monetary_load_locale(const char *name)
+{
int ret;
+
__mlocale_changed = 1;
ret = __part_load_locale(name, &_monetary_using_locale,
_monetary_locale_buf, "LC_MONETARY",
@@ -95,12 +98,12 @@ __monetary_load_locale(const char *name) {
M_ASSIGN_CHAR(p_sign_posn);
M_ASSIGN_CHAR(n_sign_posn);
}
- return ret;
+ return (ret);
}
struct lc_monetary_T *
-__get_current_monetary_locale(void) {
-
+__get_current_monetary_locale(void)
+{
return (_monetary_using_locale
? &_monetary_locale
: (struct lc_monetary_T *)&_C_monetary_locale);
diff --git a/lib/libc/locale/lnumeric.c b/lib/libc/locale/lnumeric.c
index 3d1742f..0fb0aab 100644
--- a/lib/libc/locale/lnumeric.c
+++ b/lib/libc/locale/lnumeric.c
@@ -49,8 +49,8 @@ static int _numeric_using_locale;
static char *_numeric_locale_buf;
int
-__numeric_load_locale(const char *name) {
-
+__numeric_load_locale(const char *name)
+{
int ret;
__nlocale_changed = 1;
@@ -61,12 +61,12 @@ __numeric_load_locale(const char *name) {
if (ret == 0 && _numeric_using_locale)
_numeric_locale.grouping =
__fix_locale_grouping_str(_numeric_locale.grouping);
- return ret;
+ return (ret);
}
struct lc_numeric_T *
-__get_current_numeric_locale(void) {
-
+__get_current_numeric_locale(void)
+{
return (_numeric_using_locale
? &_numeric_locale
: (struct lc_numeric_T *)&_C_numeric_locale);
OpenPOWER on IntegriCloud