Add/change a few #ifdef comments in locale code for clearness

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2016-08-23 12:43:40 +02:00
parent 3eace743b2
commit f4fb06ce17
4 changed files with 13 additions and 13 deletions

View File

@ -64,7 +64,7 @@ _duplocale_r (struct _reent *p, struct __locale_t *locobj)
if (!__loadlocale (&tmp_locale, i, tmp_locale.categories[i])) if (!__loadlocale (&tmp_locale, i, tmp_locale.categories[i]))
goto error; goto error;
} }
#endif #endif /* __HAVE_LOCALE_INFO__ */
/* Allocate new locale_t. */ /* Allocate new locale_t. */
new_locale = (struct __locale_t *) _calloc_r (p, 1, sizeof *new_locale); new_locale = (struct __locale_t *) _calloc_r (p, 1, sizeof *new_locale);
if (!new_locale) if (!new_locale)
@ -83,7 +83,7 @@ error:
_free_r (p, (void *) tmp_locale.lc_cat[i].ptr); _free_r (p, (void *) tmp_locale.lc_cat[i].ptr);
_free_r (p, tmp_locale.lc_cat[i].buf); _free_r (p, tmp_locale.lc_cat[i].buf);
} }
#endif #endif /* __HAVE_LOCALE_INFO__ */
return NULL; return NULL;
} }

View File

@ -50,7 +50,7 @@ _freelocale_r (struct _reent *p, struct __locale_t *locobj)
_free_r (p, (void *) locobj->lc_cat[i].ptr); _free_r (p, (void *) locobj->lc_cat[i].ptr);
_free_r (p, locobj->lc_cat[i].buf); _free_r (p, locobj->lc_cat[i].buf);
} }
#endif #endif /* __HAVE_LOCALE_INFO__ */
_free_r (p, locobj); _free_r (p, locobj);
} }

View File

@ -234,7 +234,7 @@ const struct __locale_t __C_locale =
"\1", "\1",
"ASCII", "ASCII",
"ASCII", "ASCII",
#else #else /* __HAVE_LOCALE_INFO__ */
{ {
{ NULL, NULL }, /* LC_ALL */ { NULL, NULL }, /* LC_ALL */
#ifdef __CYGWIN__ #ifdef __CYGWIN__
@ -248,7 +248,7 @@ const struct __locale_t __C_locale =
{ &_C_time_locale, NULL }, /* LC_TIME */ { &_C_time_locale, NULL }, /* LC_TIME */
{ &_C_messages_locale, NULL }, /* LC_MESSAGES */ { &_C_messages_locale, NULL }, /* LC_MESSAGES */
}, },
#endif #endif /* __HAVE_LOCALE_INFO__ */
}; };
struct __locale_t __global_locale = struct __locale_t __global_locale =
@ -274,7 +274,7 @@ struct __locale_t __global_locale =
"\1", "\1",
"ASCII", "ASCII",
"ASCII", "ASCII",
#else #else /* __HAVE_LOCALE_INFO__ */
{ {
{ NULL, NULL }, /* LC_ALL */ { NULL, NULL }, /* LC_ALL */
#ifdef __CYGWIN__ #ifdef __CYGWIN__
@ -288,7 +288,7 @@ struct __locale_t __global_locale =
{ &_C_time_locale, NULL }, /* LC_TIME */ { &_C_time_locale, NULL }, /* LC_TIME */
{ &_C_messages_locale, NULL }, /* LC_MESSAGES */ { &_C_messages_locale, NULL }, /* LC_MESSAGES */
}, },
#endif #endif /* __HAVE_LOCALE_INFO__ */
}; };
/* Renamed from current_locale_string to make clear this is only the /* Renamed from current_locale_string to make clear this is only the
@ -313,7 +313,7 @@ _DEFUN(_setlocale_r, (p, category, locale),
return NULL; return NULL;
} }
return "C"; return "C";
#else /* !_MB_CAPABLE */ #else /* _MB_CAPABLE */
static char new_categories[_LC_LAST][ENCODING_LEN + 1]; static char new_categories[_LC_LAST][ENCODING_LEN + 1];
static char saved_categories[_LC_LAST][ENCODING_LEN + 1]; static char saved_categories[_LC_LAST][ENCODING_LEN + 1];
int i, j, len, saverr; int i, j, len, saverr;
@ -445,7 +445,7 @@ _DEFUN(_setlocale_r, (p, category, locale),
} }
} }
return currentlocale (); return currentlocale ();
#endif /* !_MB_CAPABLE */ #endif /* _MB_CAPABLE */
} }
#ifdef _MB_CAPABLE #ifdef _MB_CAPABLE

View File

@ -149,12 +149,12 @@ _newlocale_r (struct _reent *p, int category_mask, const char *locale,
subsequent error. */ subsequent error. */
tmp_locale.lc_cat[i].ptr = base->lc_cat[i].ptr; tmp_locale.lc_cat[i].ptr = base->lc_cat[i].ptr;
tmp_locale.lc_cat[i].buf = (void *) -1; tmp_locale.lc_cat[i].buf = (void *) -1;
#else #else /* !__HAVE_LOCALE_INFO__ */
if (i == LC_CTYPE) if (i == LC_CTYPE)
strcpy (tmp_locale.ctype_codeset, base->ctype_codeset); strcpy (tmp_locale.ctype_codeset, base->ctype_codeset);
else if (i == LC_MESSAGES) else if (i == LC_MESSAGES)
strcpy (tmp_locale.message_codeset, base->message_codeset); strcpy (tmp_locale.message_codeset, base->message_codeset);
#endif #endif /* !__HAVE_LOCALE_INFO__ */
} }
/* Otherwise, if the category is in category_mask, create entry. */ /* Otherwise, if the category is in category_mask, create entry. */
else if (((1 << i) & category_mask) != 0) else if (((1 << i) & category_mask) != 0)
@ -184,7 +184,7 @@ _newlocale_r (struct _reent *p, int category_mask, const char *locale,
tmp_locale.lc_cat[i].buf = base->lc_cat[i].buf; tmp_locale.lc_cat[i].buf = base->lc_cat[i].buf;
base->lc_cat[i].ptr = base->lc_cat[i].buf = NULL; base->lc_cat[i].ptr = base->lc_cat[i].buf = NULL;
} }
#endif #endif /* __HAVE_LOCALE_INFO__ */
_freelocale_r (p, base); _freelocale_r (p, base);
} }
@ -203,7 +203,7 @@ error:
_free_r (p, (void *) tmp_locale.lc_cat[i].ptr); _free_r (p, (void *) tmp_locale.lc_cat[i].ptr);
_free_r (p, tmp_locale.lc_cat[i].buf); _free_r (p, tmp_locale.lc_cat[i].buf);
} }
#endif #endif /* __HAVE_LOCALE_INFO__ */
return NULL; return NULL;
} }