summaryrefslogtreecommitdiff
path: root/lib/localename.c
Commit message (Collapse)AuthorAgeFilesLines
* gnulib-common.m4: Use C2x [[maybe_unused]] when possible.Bruno Haible2021-08-221-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * m4/gnulib-common.m4 (gl_COMMON_BODY): Define _GL_UNUSED as an alias of _GL_ATTRIBUTE_MAYBE_UNUSED, not of _GL_ATTRIBUTE_UNUSED. * lib/binary-io.h (__gl_setmode): Put _GL_UNUSED before, not after, the declaration. * lib/c-stack.c (null_action, segv_handler, overflow_handler, c_stack_action): Likewise. * lib/chown.c (chown): Likewise. * lib/clean-temp-simple.c (cleanup_action): Likewise. * lib/fts.c (dirent_inode_sort_may_be_useful, leaf_optimization, fts_set): Likewise. * lib/getgroups.c (getgroups): Likewise. * lib/getopt.c (_getopt_initialize): Likewise. * lib/getugroups.c (getugroups): Likewise. * lib/localename.c (gl_locale_name_thread_unsafe, gl_locale_name_thread, gl_locale_name_posix, gl_locale_name_environ): Likewise. * lib/mkdir.c (rpl_mkdir): Likewise. * lib/mkfifo.c (mkfifo): Likewise. * lib/mkfifoat.c (mkfifoat): Likewise. * lib/mknod.c (mknod): Likewise. * lib/mknodat.c (mknodat): Likewise. * lib/mountlist.c (me_remote): Likewise. * lib/openpty.c (openpty): Likewise. * lib/parse-datetime.y (yyerror): Likewise. * lib/passfd.c (sendfd, recvfd): Likewise. * lib/pthread-cond.c (pthread_condattr_destroy, pthread_cond_init, pthread_cond_wait, pthread_cond_timedwait, pthread_cond_signal, pthread_cond_broadcast, pthread_cond_destroy): Likewise. * lib/pthread-mutex.c (pthread_mutexattr_destroy, pthread_mutex_init, pthread_mutex_lock, pthread_mutex_trylock, pthread_mutex_timedlock, pthread_mutex_unlock, pthread_mutex_destroy): Likewise. * lib/pthread-rwlock.c (pthread_rwlockattr_destroy, pthread_rwlock_init, pthread_rwlock_timedrdlock, pthread_rwlock_timedwrlock): Likewise. * lib/pthread-spin.c (pthread_spin_init, pthread_spin_lock, pthread_spin_trylock, pthread_spin_unlock, pthread_spin_destroy): Likewise. * lib/pthread-thread.c (pthread_attr_destroy): Likewise. * lib/readlink.c (readlink): Likewise. * lib/rename.c (rpl_rename): Likewise. * lib/set-permissions.c (set_permissions): Likewise. * lib/sockets.c (gl_sockets_startup): Likewise. * lib/stat-time.h (get_stat_birthtime_ns, get_stat_birthtime, stat_time_normalize): Likewise. * lib/strptime.c (__strptime_internal): Likewise. * lib/strtod.c (LDEXP): Likewise. * lib/symlink.c (symlink): Likewise. * lib/symlinkat.c (symlinkat): Likewise. * lib/tempname.c (try_dir, try_nocreate): Likewise. * lib/textstyle.in.h (styled_ostream_begin_use_class, styled_ostream_end_use_class, styled_ostream_get_hyperlink_ref, styled_ostream_get_hyperlink_id, styled_ostream_set_hyperlink, styled_ostream_flush_to_current_style, fd_ostream_create, term_ostream_get_color, term_ostream_set_color, term_ostream_get_bgcolor, term_ostream_set_bgcolor, term_ostream_get_weight, term_ostream_set_weight, term_ostream_get_posture, term_ostream_set_posture, term_ostream_get_underline, term_ostream_set_underline, term_ostream_get_hyperlink_ref, term_ostream_get_hyperlink_id, term_ostream_set_hyperlink, term_ostream_create, term_styled_ostream_create, html_styled_ostream_create, handle_color_option, handle_style_option, style_file_prepare, styled_ostream_create, libtextstyle_set_failure_exit_code): Likewise. * lib/unicodeio.c (exit_failure_callback, fallback_failure_callback): Likewise. * lib/wait-process.c (cleanup_slaves_action): Likewise. * tests/signature.h (SIGNATURE_CHECK2): Likewise. * tests/test-areadlink.c (do_areadlink): Likewise. * tests/test-areadlinkat.c (do_areadlinkat): Likewise. * tests/test-ceilf-ieee.c (main): Likewise. * tests/test-ceilf1.c (main): Likewise. * tests/test-dirent.c (dir): Likewise. * tests/test-fchownat.c (main): Likewise. * tests/test-fdopendir.c (main): Likewise. * tests/test-filenamecat.c (main): Likewise. * tests/test-floor1.c (main): Likewise. * tests/test-floorf-ieee.c (main): Likewise. * tests/test-floorf1.c (main): Likewise. * tests/test-fseeko.c (main): Likewise. * tests/test-fstatat.c (main): Likewise. * tests/test-ftello.c (main): Likewise. * tests/test-getdomainname.c (main): Likewise. * tests/test-getgroups.c (main): Likewise. * tests/test-gethostname.c (main): Likewise. * tests/test-math-c++.cc (OVERLOADED_CHECK): Likewise. * tests/test-mkdirat.c (main): Likewise. * tests/test-openat.c (main): Likewise. * tests/test-parse-datetime.c (main): Likewise. * tests/test-quotearg-simple.c (main): Likewise. * tests/test-quotearg.c (main): Likewise. * tests/test-sethostname2.c (main): Likewise. * tests/test-unlinkat.c (main): Likewise. * tests/test-version-etc.c (main): Likewise. * tests/test-xalloc-die.c (main): Likewise. * tests/test-xfprintf-posix.c (main): Likewise. * tests/test-xprintf-posix.c (main): Likewise. * tests/test-xvasprintf.c (main): Likewise.
* Sync with GNU gettext.Bruno Haible2021-06-201-11/+3
| | | | | | * lib/tsearch.c: Ignore IN_LIBINTL. * lib/localename-table.h: Likewise. * lib/localename.c: Ignore IN_LIBINTL in some places.
* free-posix: use more often in other modulesPaul Eggert2021-03-251-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This lets us simplify cleanup code that calls ‘free’. * lib/amemxfrm.c (amemxfrm): * lib/areadlink-with-size.c (areadlink_with_size): * lib/areadlinkat-with-size.c (areadlinkat_with_size): * lib/astrxfrm.c (astrxfrm): * lib/dprintf.c (dprintf): * lib/execute.c (execute): * lib/execvpe.c (execvpe): * lib/fchdir.c (get_name): * lib/file-has-acl.c (file_has_acl): * lib/fprintf.c (fprintf): * lib/getcwd-lgpl.c (rpl_getcwd): * lib/getgroups.c (rpl_getgroups): * lib/link.c (link, rpl_link): * lib/linkat.c (link_immediate, link_follow, linkat_follow): * lib/localename.c (newlocale, duplocale): * lib/mgetgroups.c (mgetgroups): * lib/mountlist.c (read_file_system_list): * lib/pipe-filter-gi.c (pipe_filter_gi_close): * lib/putenv.c (_unsetenv, putenv): * lib/read-file.c (read_file): * lib/rename.c (rpl_rename): * lib/savedir.c (streamsavedir, savedir): * lib/spawni.c (do_open, __spawni): * lib/spawn-pipe.c (create_pipe): * lib/striconv.c (mem_cd_iconv, str_cd_iconv, str_iconv): * lib/striconveh.c (mem_cd_iconveh_internal, str_cd_iconveh) (mem_iconveh, str_iconveh): * lib/supersede.c (open_supersede, close_supersede): * lib/vasnprintf.c (VASNPRINTF): * lib/vdprintf.c (vdprintf): * lib/vfprintf.c (vfprintf): * lib/wcscoll-impl.h (wcscoll): * lib/wcsxfrm-impl.h (wcsxfrm): * lib/xgetdomainname.c (xgetdomainname): * lib/xgethostname.c (xgethostname): Simplify by assuming that ‘free’ preserves errno. * lib/localename.c: Do not include errno.h. * modules/amemxfrm, modules/areadlink-with-size: * modules/areadlinkat-with-size, modules/astrxfrm: * modules/c-vasnprintf, modules/dprintf, modules/execute: * modules/execvpe, modules/fchdir, modules/file-has-acl: * modules/fprintf-posix, modules/getcwd-lgpl, modules/getgroups: * modules/link, modules/linkat, modules/localename: * modules/mgetgroups, modules/mountlist, modules/pipe-filter-gi: * modules/posix_spawn-internal, modules/putenv, modules/read-file: * modules/rename, modules/savedir, modules/spawn-pipe: * modules/striconv, modules/striconveh, modules/supersede: * modules/vasnprintf, modules/vdprintf, modules/vfprintf-posix: * modules/wcscoll, modules/wcsxfrm, modules/xgetdomainname: * modules/xgethostname: Depend on free-posix.
* localename: Fix link error with duplocale on AIX 7.2 (regr. 2019-12-18).Bruno Haible2021-01-071-7/+1
| | | | | | | | | | | | | | | | | | | * m4/locale_h.m4 (gl_LOCALE_H_DEFAULTS): Initialize LOCALENAME_ENHANCE_LOCALE_FUNCS. * m4/intl-thread-locale.m4 (gt_FUNC_USELOCALE): Set gt_working_uselocale. (gt_INTL_THREAD_LOCALE_NAME): Set gt_fake_locales, gt_good_uselocale, gt_localename_enhances_locale_funcs, LOCALENAME_ENHANCE_LOCALE_FUNCS. Define HAVE_GOOD_USELOCALE, LOCALENAME_ENHANCE_LOCALE_FUNCS. * m4/localename.m4 (gl_LOCALENAME): Test gt_localename_enhances_locale_funcs instead of gt_nameless_locales. * modules/locale (Makefile.am): Substitute LOCALENAME_ENHANCE_LOCALE_FUNCS. * lib/locale.in.h (newlocale, duplocale, freelocale): Don't override if module 'localename' is in use but LOCALENAME_ENHANCE_LOCALE_FUNCS is 0. * lib/localename.c (HAVE_GOOD_USELOCALE): Don't define here. (get_locale_t_name, newlocale, duplocale, freelocale): Define if LOCALENAME_ENHANCE_LOCALE_FUNCS.
* maint: run 'make update-copyright'Paul Eggert2020-12-311-1/+1
|
* localename: Fix a couple of "unused parameter" warnings.Bruno Haible2020-10-051-4/+4
| | | | | | | | | Reported by Marc Nieper-Wißkirchen <marc@nieper-wisskirchen.de> in <https://lists.gnu.org/archive/html/bug-gnulib/2020-10/msg00014.html>. * lib/localename.c (gl_locale_name_thread_unsafe, gl_locale_name_thread, gl_locale_name_posix, gl_locale_name_environ): Add _GL_UNUSED in parameter list.
* thread-optim: Export function-like macros only.Bruno Haible2020-08-121-3/+4
| | | | | | | | | | | | | Suggested by Paul Eggert. * lib/thread-optim.h (gl_multithreaded): New macro. (IF_MT_DECL, IF_MT): Remove macros. * doc/multithread.texi (Multithreading Optimizations): Add a small example. * lib/fatal-signal.c: Update all uses. * lib/clean-temp.c: Likewise. * lib/localename.c: Likewise. * modules/localename (Depends-on): Add stdbool.
* localename: Use module 'thread-optim'.Bruno Haible2020-08-081-18/+22
| | | | | | * lib/localename.c: Include thread-optim.h. (struniq): Use IF_MT macro. * modules/localename (Depends-on): Add thread-optim.
* Don't assume that UNICODE is not defined.Bruno Haible2020-05-301-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many Windows API functions are defined differently (redirecting to a function with suffix 'W') if the application defines the macro UNICODE than by default (redirecting to a function with suffix 'A'). * lib/clean-temp.c (OSVERSIONINFO, GetVersionEx): Redirect to the variant with suffix 'A'. * lib/dirent-private.h (WIN32_FIND_DATA): Likewise. * lib/gc-gnulib.c (CryptAcquireContext): Likewise. * lib/getaddrinfo.c (GetModuleHandle): Likewise. * lib/getlogin.c (GetUserName): Likewise. * lib/getlogin_r.c (GetUserName): Likewise. * lib/gettimeofday.c (LoadLibrary): Likewise. * lib/isatty.c (LoadLibrary, QueryFullProcessImageName): Likewise. * lib/link.c (GetModuleHandle, CreateHardLink): Likewise. * lib/localename.c (GetLocaleInfo, EnumSystemLocales): Likewise. * lib/mountlist.c (GetDriveType): Likewise. * lib/nonblocking.c (GetNamedPipeHandleState): Likewise. * lib/opendir.c (WIN32_FIND_DATA, GetFullPathName, FindFirstFile): Likewise. * lib/physmem.c (GetModuleHandle): Likewise. * lib/poll.c (GetModuleHandle, PeekConsoleInput, CreateEvent, PeekMessage, DispatchMessage): Likewise. * lib/progreloc.c (GetModuleFileName): Likewise. * lib/putenv.c (SetEnvironmentVariable): Likewise. * lib/read.c (GetNamedPipeHandleState): Likewise. * lib/readdir.c (FindNextFile): Likewise. * lib/relocatable.c (GetModuleFileName): Likewise. * lib/rename.c (MoveFileEx): Likewise. * lib/rewinddir.c (FindFirstFile): Likewise. * lib/select.c (GetModuleHandle, PeekConsoleInput, CreateEvent, PeekMessage, DispatchMessage): Likewise. * lib/sethostname.c (GetComputerNameEx, SetComputerNameEx): Likewise. * lib/socket.c (WSASocket): Likewise. * lib/stat-w32.c (LoadLibrary, GetFinalPathNameByHandle): Likewise. * lib/stat.c (WIN32_FIND_DATA, CreateFile, FindFirstFile): Likewise. * lib/stdio-read.c (GetNamedPipeHandleState): Likewise. * lib/stdio-write.c (GetNamedPipeHandleState): Likewise. * lib/tmpdir.c (GetTempPath): Likewise. * lib/tmpfile.c (OSVERSIONINFO, GetVersionEx, GetTempPath): Likewise. * lib/uname.c (OSVERSIONINFO, GetVersionEx): Likewise. * lib/utime.c (CreateFile, GetFileAttributes): Likewise. * lib/windows-cond.c (CreateEvent): Likewise. * lib/windows-rwlock.c (CreateEvent): Likewise. * lib/windows-timedmutex.c (CreateEvent): Likewise. * lib/windows-timedrecmutex.c (CreateEvent): Likewise. * lib/windows-timedrwlock.c (CreateEvent): Likewise. * lib/write.c (GetNamedPipeHandleState): Likewise.
* Don't assume that UNICODE is not defined.Bruno Haible2020-05-281-1/+1
| | | | | | | | | | | | Some Windows types, such as TCHAR, LPTSTR, LPCTSTR, are defined differently if the application defines the macro UNICODE. Reported by Steve Lhomme <robux4@ycbcr.xyz> in <https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00184.html>. * lib/link.c (CreateHardLinkFuncType): Use LPCSTR, not LPCTSTR. * lib/localename.c (enum_locales_fn): Use LPSTR, not LPTSTR. * lib/stat-w32.c (GetFinalPathNameByHandleFuncType): Likewise.
* maint: Run 'make update-copyright'Paul Eggert2019-12-311-1/+1
|
* setlocale-null: Add standalone include file.Bruno Haible2019-12-221-0/+1
| | | | | | | | | | | | * lib/setlocale_null.h: New file, extracted from lib/locale.in.h. * lib/locale.in.h: Include setlocale_null.h. (SETLOCALE_NULL_MAX, SETLOCALE_NULL_ALL_MAX, setlocale_null_r, setlocale_null): Remove declarations. * lib/setlocale_null.c: Include setlocale_null.h. * lib/localename.c: Likewise. * modules/setlocale-null (Files): Add lib/setlocale_null.h. (Depends-on): Add snippet/arg-nonnull. (Include): Allow either "setlocale_null.h" or <locale.h>.
* localename: Fix test failure on AIX 7.2.Bruno Haible2019-12-191-0/+2
| | | | | | | * m4/intl-thread-locale.m4 (gt_INTL_THREAD_LOCALE_NAME): Enable nameless locales on AIX. * lib/localename.c (gl_locale_name_thread_unsafe): Handle nameless locales on AIX.
* localename: Ensure multithread-safety in future changes.Bruno Haible2019-12-181-3/+10
| | | | | | | * lib/localename.c (setlocale): Reference the system's setlocale(). (get_locale_t_name): Invoke setlocale_null instead of setlocale. (gl_locale_name_posix): Likewise. * modules/localename (Depends-on): Add setlocale-null.
* localename: Optimize code for native Windows.Bruno Haible2019-12-181-9/+1
| | | | | * lib/localename.c (gl_locale_name_posix): Remove handling of LC_ALL category (not allowed here).
* localename: Fix default on macOS.Bruno Haible2019-05-201-20/+15
| | | | | | | | * m4/intlmacosx.m4 (gt_INTL_MACOSX): Don't test for CFLocaleCopyCurrent. * lib/localename.c: Remove includes for HAVE_CFLOCALECOPYCURRENT. (gl_locale_name_environ, gl_locale_name_default): Remove code for HAVE_CFLOCALECOPYCURRENT. * lib/localename.h (gl_locale_name_default): Update.
* localename: Fix crash on mingw (regression from 2018-11-23).Bruno Haible2019-04-271-8/+9
| | | | | * lib/localename.c (gl_locale_name_posix): Don't attempt to convert a locale name that is null.
* all: Update URLs to msdn.microsoft.com.Bruno Haible2019-03-141-2/+2
| | | | | * lib/stat-w32.c et al.: Update URLs after most of msdn.microsoft.com was moved to docs.microsoft.com.
* localename: Assume setlocale function.Bruno Haible2019-01-061-1/+1
| | | | | * lib/localename.c (gl_locale_name_posix): Assume setlocale exists. * m4/localename.m4 (gl_LOCALENAME): Don't test whether setlocale exists.
* maint: Run 'make update-copyright'Paul Eggert2019-01-011-1/+1
|
* localename: Fix test failure on AIX 7.Bruno Haible2018-12-181-2/+2
| | | | | | | | | | | | | | | Reported by Assaf Gordon in <https://lists.gnu.org/archive/html/sed-devel/2018-12/msg00019.html>. * m4/intl-thread-locale.m4 (gt_FUNC_USELOCALE): New macro. (gt_INTL_THREAD_LOCALE_NAME): Invoke it. Test gt_cv_func_uselocale_works instead of ac_cv_func_uselocale. * lib/localename.c: Test HAVE_WORKING_USELOCALE instead of HAVE_USELOCALE. * lib/localename-table.h: Likewise. * lib/localename-table.c: Likewise. * tests/test-localename.c: Likewise. * doc/posix-functions/uselocale.texi: Mention the AIX problem.
* localename: Update comments regarding Cygwin.Bruno Haible2018-12-181-1/+1
| | | | | | | | * lib/localename.c: Update comment. * doc/posix-functions/uselocale.texi: Update platforms list. * doc/posix-functions/newlocale.texi: Likewise. * doc/posix-functions/duplocale.texi: Likewise. * doc/posix-functions/freelocale.texi: Likewise.
* localename: Fix test failure on OpenBSD >= 6.2.Bruno Haible2018-12-161-7/+13
| | | | | | | | | | | | | | * m4/intl-thread-locale.m4 (gt_INTL_THREAD_LOCALE_NAME): Test for fake locale system. Define HAVE_FAKE_LOCALES in this case. * lib/localename.c (HAVE_GOOD_USELOCALE): New macro. Use it instead of HAVE_USELOCALE. * tests/test-localename.c (HAVE_GOOD_USELOCALE): New macro. Use it instead of HAVE_NEWLOCALE && HAVE_USELOCALE. * doc/posix-functions/uselocale.texi: Mention OpenBSD problem. Update platforms list. * doc/posix-functions/newlocale.texi: Likewise. * doc/posix-functions/duplocale.texi: Update platforms list. * doc/posix-functions/freelocale.texi: Likewise.
* localename: Update comments.Bruno Haible2018-12-161-1/+2
| | | | * lib/localename.c (HAVE_USELOCALE): Update list of platforms.
* localename: Fix gettext test failures on mingw.Bruno Haible2018-11-241-23/+41
| | | | | * lib/localename.c (gl_locale_name_posix): Convert the result of gl_locale_name_environ to XPG syntax.
* localename: Simplify support for per-thread locales on Solaris 11.4.Bruno Haible2018-10-231-2/+22
| | | | | | | | | | | | | | | | | | | * m4/intl-thread-locale.m4: Renamed from m4/intlsolaris.m4. (gt_INTL_THREAD_LOCALE_NAME): Renamed from gt_INTL_SOLARIS. Define HAVE_SOLARIS114_LOCALES instead of HAVE_NAMELESS_LOCALES. * lib/localename.c: Handle HAVE_SOLARIS114_LOCALES through Solaris specific code. * lib/localename-table.h: Update comments. * lib/localename-table.c: Update comments. * m4/localename.m4 (gl_LOCALENAME): Require gt_INTL_THREAD_LOCALE_NAME. Test for 'uselocale'. Don't invoke gt_INTL_SOLARIS. * m4/intl.m4 (AM_INTL_SUBDIR): Require gt_INTL_THREAD_LOCALE_NAME. Test for 'uselocale'. Set HAVE_NAMELESS_LOCALES. (gt_INTL_SUBDIR_CORE): Don't invoke gt_INTL_SOLARIS. Don't set HAVE_NAMELESS_LOCALES here. * modules/localename (Files): Add m4/intl-thread-locale.m4. Remove m4/intlsolaris.m4. * modules/gettext (Files): Likewise.
* localename: Fine-tune support for per-thread locales on Solaris 11.4.Bruno Haible2018-10-221-44/+9
| | | | | | | | | | | | | | | | | | * lib/localename-table.h: New file, extracted from lib/localename.c. * lib/localename-table.c: Likewise. * lib/localename.c: Include localename-table.h. (get_locale_t_name, newlocale, duplocale, freelocale): Invoke locale_hash_function instead of pointer_hash. * modules/localename (Files): Add lib/localename-table.h, lib/localename-table.c. (lib_SOURCES): Add localename-table.c. * m4/intlsolaris.m4 (gt_INTL_SOLARIS): Require AC_CANONICAL_HOST. Test for Solaris 11.4 locale system only on Solaris. Test for it independently whether getlocalename_l exists. * m4/intl.m4 (gt_INTL_SUBDIR_CORE): Don't test for 'uselocale' and 'getlocalename_l'. Instead, invoke gt_INTL_SOLARIS. Set HAVE_NAMELESS_LOCALES. * modules/gettext (Files): Add m4/intlsolaris.m4.
* localename: Add support for per-thread locales on Solaris 11.4.Bruno Haible2018-10-141-10/+431
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/locale.in.h (newlocale, freelocale): New declarations. (duplocale): Declare also when the 'localename' module requests it. * lib/localename.c (struniq_hash_node): Renamed from hash_node. (STRUNIQ_HASH_TABLE_SIZE): Renamed from HASH_TABLE_SIZE. (struniq): Update. (struct locale_categories_names, struct locale_hash_node): New types. (LOCALE_HASH_TABLE_SIZE): New constant. (locale_hash_table, locale_lock): New variables. (pointer_hash, get_locale_t_name): New functions. (newlocale, duplocale, freelocale): New overridden functions. (gl_locale_name_thread_unsafe): Use get_locale_t_name. * m4/intlsolaris.m4: New file. * m4/localename.m4 (gl_LOCALENAME): Require gl_LOCALE_H_DEFAULTS. Invoke gt_INTL_SOLARIS. Set HAVE_NEWLOCALE, HAVE_DUPLOCALE, HAVE_FREELOCALE, REPLACE_NEWLOCALE, REPLACE_DUPLOCALE, REPLACE_FREELOCALE. * m4/locale_h.m4 (gl_LOCALE_H): Test whether newlocale, freelocale are declared. (gl_LOCALE_H_DEFAULTS): Initialize GNULIB_LOCALENAME, HAVE_NEWLOCALE, HAVE_FREELOCALE, REPLACE_NEWLOCALE, REPLACE_FREELOCALE. * modules/locale (Makefile.am): Substitute GNULIB_LOCALENAME, HAVE_NEWLOCALE, HAVE_FREELOCALE, REPLACE_NEWLOCALE, REPLACE_FREELOCALE. * modules/localename (Files): Add intlsolaris.m4. (Depends-on): Add 'locale'. (configure.ac): Invoke gl_LOCALE_MODULE_INDICATOR. * tests/test-locale-c++.cc (newlocale, freelocale): Prepare for checking the signatures.
* Update list of locale names with scripts on macOS.Bruno Haible2018-09-161-2/+25
| | | | | * lib/localename.c (gl_locale_name_canonicalize): Update tables to match Mac OS X 10.13 and recent glibc.
* localename: Revisit macOS specific code.Bruno Haible2018-09-161-20/+19
| | | | | * lib/localename.c (gl_locale_name_default): Reduce code duplication. Fix comments about Mac OS X versions.
* all: Replace more http URLs by https URLs.Bruno Haible2018-05-051-2/+2
| | | | | * lib/localename.c: Use https: URL. * lib/timespec.h: Likewise.
* Simplify code. Drop support for Borland C++ on Windows.Bruno Haible2018-05-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reported by Gisle Vanem <gisle.vanem@gmail.com>. * lib/accept4.c: Simplify 'defined _WIN32 || defined __WIN32__' to just 'defined _WIN32'. * lib/canonicalize-lgpl.c: Likewise. * lib/classpath.c: Likewise. * lib/clean-temp.c: Likewise. * lib/csharpexec.c: Likewise. * lib/ctime.c: Likewise. * lib/dosname.h: Likewise. * lib/dup2.c: Likewise. * lib/errno.in.h: Likewise. * lib/error.c: Likewise. * lib/euidaccess.c: Likewise. * lib/execute.c: Likewise. * lib/fcntl.in.h: Likewise. * lib/fcntl.c: Likewise. * lib/filename.h: Likewise. * lib/findprog.c: Likewise. * lib/flock.c: Likewise. * lib/fopen.c: Likewise. * lib/freopen.c: Likewise. * lib/fstat.c: Likewise. * lib/fsync.c: Likewise. * lib/gc-gnulib.c: Likewise. * lib/get-rusage-data.c: Likewise. * lib/getaddrinfo.c: Likewise. * lib/getdelim.c: Likewise. * lib/getdtablesize.c: Likewise. * lib/gethostname.c: Likewise. * lib/getlogin.c: Likewise. * lib/getlogin_r.c: Likewise. * lib/getopt.c: Likewise. * lib/getpagesize.c: Likewise. * lib/getpass.c: Likewise. * lib/getrusage.c: Likewise. * lib/gettimeofday.c: Likewise. * lib/glob.c: Likewise. * lib/inttypes.in.h: Likewise. * lib/isapipe.c: Likewise. * lib/javaexec.c: Likewise. * lib/link.c: Likewise. * lib/localcharset.c: Likewise. * lib/localename.h: Likewise. * lib/localename.c: Likewise. * lib/localtime.c: Likewise. * lib/lseek.c: Likewise. * lib/mbsinit.c: Likewise. * lib/mkdir.c: Likewise. * lib/msvc-nothrow.h: Likewise. * lib/nanosleep.c: Likewise. * lib/nl_langinfo.c: Likewise. * lib/nonblocking.c: Likewise. * lib/nproc.c: Likewise. * lib/open.c: Likewise. * lib/openpty.c: Likewise. * lib/pathmax.h: Likewise. * lib/pipe-filter-aux.c: Likewise. * lib/pipe-filter-gi.c: Likewise. * lib/pipe-filter-ii.c: Likewise. * lib/pipe.c: Likewise. * lib/pipe2.c: Likewise. * lib/poll.c: Likewise. * lib/popen.c: Likewise. * lib/posix_openpt.c: Likewise. * lib/printf-parse.c: Likewise. * lib/progreloc.c: Likewise. * lib/putenv.c: Likewise. * lib/read.c: Likewise. * lib/relocatable.c: Likewise. * lib/rename.c: Likewise. * lib/same-inode.h: Likewise. * lib/secure_getenv.c: Likewise. * lib/select.c: Likewise. * lib/sethostname.c: Likewise. * lib/setlocale.c: Likewise. * lib/sigaction.c: Likewise. * lib/sigprocmask.c: Likewise. * lib/sleep.c: Likewise. * lib/spawn-pipe.h: Likewise. * lib/spawn-pipe.c: Likewise. * lib/spawni.c: Likewise. * lib/stat-time.h: Likewise. * lib/stat-w32.c: Likewise. * lib/stat.c: Likewise. * lib/stdio.in.h: Likewise. * lib/stdio-impl.h: Likewise. * lib/stdio-read.c: Likewise. * lib/stdio-write.c: Likewise. * lib/stdlib.in.h: Likewise. * lib/strerror_r.c: Likewise. * lib/strftime-fixes.c: Likewise. * lib/sys_stat.in.h: Likewise. * lib/sys_types.in.h: Likewise. * lib/sys_wait.in.h : Likewise. * lib/system-quote.h: Likewise. * lib/system-quote.c: Likewise. * lib/tmpdir.c: Likewise. * lib/tzset.c: Likewise. * lib/uname.c: Likewise. * lib/unistd.in.h: Likewise. * lib/utime.in.h: Likewise. * lib/utime.c: Likewise. * lib/utimecmp.c: Likewise. * lib/utimens.c: Likewise. * lib/vasnprintf.c: Likewise. * lib/vma-iter.h: Likewise. * lib/vma-iter.c: Likewise. * lib/wait-process.c: Likewise. * lib/wcsftime.c: Likewise. * lib/wctype.in.h: Likewise. * lib/write.c: Likewise. * tests/nap.h: Likewise. * tests/test-cloexec.c: Likewise. * tests/test-dup-safer.c: Likewise. * tests/test-dup2.c: Likewise. * tests/test-dup3.c: Likewise. * tests/test-fcntl.c: Likewise. * tests/test-get-rusage-data.c: Likewise. * tests/test-getaddrinfo.c: Likewise. * tests/test-getlogin.h: Likewise. * tests/test-isatty.c: Likewise. * tests/test-localename.c: Likewise. * tests/test-mbrtowc-w32.c: Likewise. * tests/test-nonblocking.c: Likewise. * tests/test-nonblocking-pipe-main.c: Likewise. * tests/test-nonblocking-socket-main.c: Likewise. * tests/test-nonblocking-socket.h: Likewise. * tests/test-pipe.c: Likewise. * tests/test-pipe2.c: Likewise. * tests/test-poll.c: Likewise. * tests/test-pthread_sigmask1.c: Likewise. * tests/test-select.h: Likewise. * tests/test-sethostname2.c: Likewise. * tests/test-sigprocmask.c: Likewise. * tests/test-spawn-pipe-child.c: Likewise. * tests/test-stat-time.c: Likewise. * tests/test-system-quote-main.c: Likewise. * tests/test-utimens-common.h: Likewise. * tests/test-wcrtomb-w32.c: Likewise. * m4/csharpexec.m4 (gt_CSHARPEXEC): Likewise. * m4/getcwd.m4 (gl_FUNC_GETCWD_NULL): Likewise. * m4/javacomp.m4 (gt_JAVACOMP): Likewise. * m4/javaexec.m4 (gt_JAVAEXEC): Likewise. * m4/locale-ar.m4 (gt_LOCALE_AR): Likewise. * m4/locale-fr.m4 (gt_LOCALE_FR, gt_LOCALE_FR_UTF8): Likewise. * m4/locale-ja.m4 (gt_LOCALE_JA): Likewise. * m4/locale-tr.m4 (gt_LOCALE_TR_UTF8): Likewise. * m4/locale-zh.m4 (gt_LOCALE_ZH_CN): Likewise. * m4/malloc.m4 (gl_CHECK_MALLOC_POSIX): Likewise. * m4/nocrash.m4 (GL_NOCRASH): Likewise. * m4/pathmax.m4 (gl_PATHMAX_SNIPPET): Likewise. * m4/ptsname_r.m4 (gl_PREREQ_PTSNAME_R): Likewise. * m4/stdio_h.m4 (gl_STDIO_H): Likewise. * m4/tmpfile.m4 (gl_FUNC_TMPFILE): Likewise. * m4/unistd_h.m4 (gl_UNISTD_H): Likewise.
* localename: Fix test failures on mingw.Bruno Haible2018-05-021-19/+23
| | | | | | | | * lib/localename.c (gl_locale_name_thread): Remove code specific to native Windows. (gl_locale_name_posix): Move code specific to native Windows here. * tests/test-localename.c (test_locale_name, test_locale_name_posix): Accept result without charset suffix, as it appears on mingw.
* localename: Add support for musl libc.Bruno Haible2018-02-241-1/+4
| | | | | | * m4/localename.m4 (gl_LOCALENAME): Check for <langinfo.h>. * lib/localename.c (gl_locale_name_thread_unsafe): Use NL_LOCALE_NAME on Linux platforms which define NL_LOCALE_NAME.
* localename: Add support for OpenIndiana.Bruno Haible2018-02-021-2/+20
| | | | | * lib/localename.c (gl_locale_name_thread_unsafe): Add code for Solaris 11 variants with uselocale() but without getlocalename_l().
* maint: Run 'make update-copyright'Paul Eggert2018-01-011-1/+1
|
* all: Replace many more http URLs by https URLs. Update stale URLs.Bruno Haible2017-09-141-8/+8
| | | | | * users.txt: Remove mention of 'newts'. * lib/localename.c: Update comment about LANG_SOTHO.
* all: prefer https: URLsPaul Eggert2017-09-131-1/+1
|
* localename: Fix test failure on DragonFly BSD.Bruno Haible2017-06-121-1/+1
| | | | | * lib/localename.c (gl_locale_name_thread_unsafe): Treat DragonFly BSD like FreeBSD.
* localename: Include necessary header files on Cygwin.Bruno Haible2017-05-191-1/+1
| | | | | * lib/localename.c [__CYGWIN__]: Include <langinfo.h>, since this is where NL_LOCALE_NAME is defined.
* Avoid accidental use of native Windows APIs on Cygwin.Bruno Haible2017-04-211-1/+1
| | | | | | * lib/getaddrinfo.c (WINDOWS_NATIVE): Don't define on Cygwin. * lib/localcharset.c (WINDOWS_NATIVE): Likewise. * lib/localename.c (WINDOWS_NATIVE): Likewise.
* localename: port to cygwin 2.6Eric Blake2017-01-201-0/+13
| | | | | | | | | | | | | | | | | | Cygwin 2.6 introduced uselocale() and thread-local locales in general, but lacks any way to get at the name of each portion of a locale_t object short of peeking behind an opaque object. Cygwin has just been patched to add NL_LOCALE_NAME() patterned after glibc's extension of the same name[1], but as that version of Cygwin has not yet been released, we might as well work around it in the meantime. [1] https://sourceware.org/ml/newlib/2017/msg00071.html * lib/localename.c (gl_locale_name_thread_unsafe): Add clause for Cygwin. * modules/localename (Depends-on): Add extensions, since NL_LOCALE_NAME() is not visible without it. Signed-off-by: Eric Blake <eblake@redhat.com>
* version-etc: new yearPaul Eggert2017-01-011-1/+1
| | | | | | | | | | * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
* flexmember: port better to GCC + valgrindPaul Eggert2016-09-071-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With a char[] flexible array member in a struct with nontrivial alignment, GCC-generated code can access past the end of the array, because GCC assumes there are padding bytes to get the struct aligned. So the common idiom of malloc (offsetof (struct s, m), n) does not properly allocate an n-byte trailing member, as malloc’s argument should be the next multiple of alignof (struct s). See GCC Bug#66661: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66661 Although C11 apparently permits this GCC optimization (i.e., there was a bug in Gnulib not in GCC), possibly this is a defect in C11. See the thread containing: https://gcc.gnu.org/ml/gcc-patches/2016-09/msg00317.html * lib/flexmember.h: New file. * lib/fnmatch.c, lib/fts.c, lib/glob.c, lib/idcache.c: * lib/localename.c, lib/time_rz.c: Include flexmember.h. * lib/fnmatch_loop.c (struct patternlist): * lib/localename.c (struct hash_node): Use FLEXIBLE_ARRAY_MEMBER. * lib/fnmatch_loop.c (EXT): * lib/fts.c (fts_alloc): * lib/glob.c (glob_in_dir): * lib/idcache.c (getuser, getuidbyname, getgroup, getgidbyname): * lib/localename.c (gl_lock_define_initialized): * lib/time_rz.c (tzalloc): Use FLEXSIZEOF instead of offsetof. * m4/flexmember.m4 (AC_C_FLEXIBLE_ARRAY_MEMBER): Check that the size of the struct can be taken. * modules/flexmember (Files): Add lib/flexmember.h. * modules/fnmatch, modules/glob, modules/localename (Depends-on): Add flexmember.
* version-etc: new yearPaul Eggert2016-01-011-1/+1
| | | | | | | | | | * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
* localename: control langinfo.h inclusionMike Frysinger2015-10-151-1/+3
| | | | | | | | | | | This header is only used to work around buggy behavior in old versions of glibc, so do not include it all the time. Otherwise we get build failures on systems that do not provide langinfo.h. * lib/localename.c: Wrap langinfo.h include with same ifdefs used in the source later on. The patch was originally submitted to gettext as: https://lists.gnu.org/archive/html/bug-gettext/2015-10/msg00011.html
* localename: fix link error on IllumosDaiki Ueno2015-07-071-2/+2
| | | | | | | | | Illumos defines __sun, but does not have getlocalename_l nor the equivalent. This partially reverts commit 387c214. * m4/localename.m4 (gl_LOCALENAME): Check if getlocalename_l is available, as well as uselocale. * lib/localename.c [HAVE_USELOCALE && __sun]: Don't fallback to use getlocalename_l if it is not available.
* localename: Implement gl_locale_name_thread_unsafe for AndroidKevin Cernekee2015-02-161-0/+2
| | | | | | * lib/localename.c: Android API level >= 21 supports two hardcoded locales: C (POSIX) and C.UTF-8. Distinguish them by checking the internal __locale_t struct.
* localename: support Solaris 12 and illumosPádraig Brady2015-01-301-1/+8
| | | | | | | * lib/localename.c (gl_locale_name_thread_unsafe): call getlocalename_l() on newer __sun platforms. Reported by Alexander Pyhalov. Fix suggested by Rich Burridge.
* version-etc: new yearPaul Eggert2014-12-311-1/+1
| | | | | | * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright date. * all files: Run 'make update-copyright'.