diff options
Diffstat (limited to 'lib/localename.c')
-rw-r--r-- | lib/localename.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/lib/localename.c b/lib/localename.c index f8cf3f2..a0752ed 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"; |