summaryrefslogtreecommitdiff
path: root/lib/localename.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2017-03-27 21:41:36 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2017-03-27 21:41:36 +0200
commit6b73edd95d603e27d55d4905134ac1327d426534 (patch)
treee0b9334e2637f17696c796ac13b2c39294bf9233 /lib/localename.c
parent0250cb64565a7d5238bbc751225d4b0236ef8316 (diff)
New upstream version 0.9.7upstream/0.9.7
Diffstat (limited to 'lib/localename.c')
-rw-r--r--lib/localename.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/lib/localename.c b/lib/localename.c
index f8cf3f23..a0752ede 100644
--- a/lib/localename.c
+++ b/lib/localename.c
@@ -1,11 +1,20 @@
/* Determine name of the currently selected locale.
- Copyright (C) 1995-2015 Free Software Foundation, Inc.
+ Copyright (C) 1995-2016 Free Software Foundation, Inc.
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
+ This program is free software: you can redistribute it and/or
+ modify it under the terms of either:
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at your
+ option) any later version.
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at your
+ option) any later version.
+
+ or both in parallel, as here.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -33,12 +42,16 @@
#include <locale.h>
#include <string.h>
+#include "flexmember.h"
+
#if HAVE_USELOCALE
/* Mac OS X 10.5 defines the locale_t type in <xlocale.h>. */
# if defined __APPLE__ && defined __MACH__
# include <xlocale.h>
# endif
-# include <langinfo.h>
+# if __GLIBC__ >= 2 && !defined __UCLIBC__
+# include <langinfo.h>
+# endif
# if !defined IN_LIBINTL
# include "glthread/lock.h"
# endif
@@ -2617,7 +2630,7 @@ string_hash (const void *x)
struct hash_node
{
struct hash_node * volatile next;
- char contents[100]; /* has variable size */
+ char contents[FLEXIBLE_ARRAY_MEMBER];
};
# define HASH_TABLE_SIZE 257
@@ -2644,7 +2657,7 @@ struniq (const char *string)
size = strlen (string) + 1;
new_node =
(struct hash_node *)
- malloc (offsetof (struct hash_node, contents[0]) + size);
+ malloc (FLEXSIZEOF (struct hash_node, contents, size));
if (new_node == NULL)
/* Out of memory. Return a statically allocated string. */
return "C";