summaryrefslogtreecommitdiff
path: root/lib/localcharset.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/localcharset.c')
-rw-r--r--lib/localcharset.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/localcharset.c b/lib/localcharset.c
index 79a55c5e..22dc38d3 100644
--- a/lib/localcharset.c
+++ b/lib/localcharset.c
@@ -1,6 +1,6 @@
/* Determine a canonical name for the current locale's character encoding.
- Copyright (C) 2000-2006, 2008-2025 Free Software Foundation, Inc.
+ Copyright (C) 2000-2006, 2008-2026 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
@@ -813,10 +813,9 @@ locale_charset (void)
environment variables (if present) or the codepage as a number. */
if (codeset != NULL && streq (codeset, "US-ASCII"))
{
- const char *locale;
static char resultbuf[2 + 10 + 1];
- locale = getenv ("LC_ALL");
+ const char *locale = getenv ("LC_ALL");
if (locale == NULL || locale[0] == '\0')
{
locale = getenv ("LC_CTYPE");
@@ -912,16 +911,13 @@ locale_charset (void)
# elif defined OS2
- const char *locale;
static char resultbuf[2 + 10 + 1];
- ULONG cp[3];
- ULONG cplen;
codeset = NULL;
/* Allow user to override the codeset, as set in the operating system,
with standard language environment variables. */
- locale = getenv ("LC_ALL");
+ const char *locale = getenv ("LC_ALL");
if (locale == NULL || locale[0] == '\0')
{
locale = getenv ("LC_CTYPE");
@@ -958,6 +954,9 @@ locale_charset (void)
if (codeset == NULL)
{
+ ULONG cp[3];
+ ULONG cplen;
+
/* OS/2 has a function returning the locale's codepage as a number. */
if (DosQueryCp (sizeof (cp), cp, &cplen))
codeset = "";