diff options
author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2024-10-31 15:27:12 (GMT) |
---|---|---|
committer | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2024-10-31 15:27:12 (GMT) |
commit | 5be04ec2ceb1df77afbca4fcbf9e92a712612d6f (patch) | |
tree | 2b2e1c71dffae827c8e45cd4cccc375093d03486 /gl/nl_langinfo.c | |
parent | 6d1d1dac32841d5ca6ee51bb09b30a6c604b17e2 (diff) | |
download | monitoring-plugins-5be04ec2ceb1df77afbca4fcbf9e92a712612d6f.tar.gz |
Sync with the latest Gnulib code (d4ec02b3cc)refs/pull/2037/head
Diffstat (limited to 'gl/nl_langinfo.c')
-rw-r--r-- | gl/nl_langinfo.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/gl/nl_langinfo.c b/gl/nl_langinfo.c index 131166f..64ff93b 100644 --- a/gl/nl_langinfo.c +++ b/gl/nl_langinfo.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* nl_langinfo() replacement: query locale dependent information. | 1 | /* nl_langinfo() replacement: query locale dependent information. |
2 | 2 | ||
3 | Copyright (C) 2007-2023 Free Software Foundation, Inc. | 3 | Copyright (C) 2007-2024 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This file is free software: you can redistribute it and/or modify | 5 | This file is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU Lesser General Public License as | 6 | it under the terms of the GNU Lesser General Public License as |
@@ -30,7 +30,12 @@ | |||
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | #if REPLACE_NL_LANGINFO && !NL_LANGINFO_MTSAFE | 32 | #if REPLACE_NL_LANGINFO && !NL_LANGINFO_MTSAFE |
33 | # if defined _WIN32 && !defined __CYGWIN__ | 33 | |
34 | # if AVOID_ANY_THREADS | ||
35 | |||
36 | /* The option '--disable-threads' explicitly requests no locking. */ | ||
37 | |||
38 | # elif defined _WIN32 && !defined __CYGWIN__ | ||
34 | 39 | ||
35 | # define WIN32_LEAN_AND_MEAN /* avoid including junk */ | 40 | # define WIN32_LEAN_AND_MEAN /* avoid including junk */ |
36 | # include <windows.h> | 41 | # include <windows.h> |
@@ -51,6 +56,7 @@ | |||
51 | # include <threads.h> | 56 | # include <threads.h> |
52 | 57 | ||
53 | # endif | 58 | # endif |
59 | |||
54 | #endif | 60 | #endif |
55 | 61 | ||
56 | /* nl_langinfo() must be multithread-safe. To achieve this without using | 62 | /* nl_langinfo() must be multithread-safe. To achieve this without using |
@@ -70,6 +76,8 @@ | |||
70 | static char * | 76 | static char * |
71 | ctype_codeset (void) | 77 | ctype_codeset (void) |
72 | { | 78 | { |
79 | /* This function is only used on platforms which don't have uselocale(). | ||
80 | Therefore we don't need to look at the per-thread locale first, here. */ | ||
73 | static char result[2 + 10 + 1]; | 81 | static char result[2 + 10 + 1]; |
74 | char buf[2 + 10 + 1]; | 82 | char buf[2 + 10 + 1]; |
75 | char locale[SETLOCALE_NULL_MAX]; | 83 | char locale[SETLOCALE_NULL_MAX]; |
@@ -184,7 +192,12 @@ nl_langinfo_unlocked (nl_item item) | |||
184 | /* Prohibit renaming this symbol. */ | 192 | /* Prohibit renaming this symbol. */ |
185 | # undef gl_get_nl_langinfo_lock | 193 | # undef gl_get_nl_langinfo_lock |
186 | 194 | ||
187 | # if defined _WIN32 && !defined __CYGWIN__ | 195 | # if AVOID_ANY_THREADS |
196 | |||
197 | /* The option '--disable-threads' explicitly requests no locking. */ | ||
198 | # define nl_langinfo_with_lock nl_langinfo_unlocked | ||
199 | |||
200 | # elif defined _WIN32 && !defined __CYGWIN__ | ||
188 | 201 | ||
189 | extern __declspec(dllimport) CRITICAL_SECTION *gl_get_nl_langinfo_lock (void); | 202 | extern __declspec(dllimport) CRITICAL_SECTION *gl_get_nl_langinfo_lock (void); |
190 | 203 | ||
@@ -449,7 +462,7 @@ nl_langinfo (nl_item item) | |||
449 | { | 462 | { |
450 | static char const months[][sizeof "September"] = { | 463 | static char const months[][sizeof "September"] = { |
451 | "January", "February", "March", "April", "May", "June", "July", | 464 | "January", "February", "March", "April", "May", "June", "July", |
452 | "September", "October", "November", "December" | 465 | "August", "September", "October", "November", "December" |
453 | }; | 466 | }; |
454 | case MON_1: | 467 | case MON_1: |
455 | case MON_2: | 468 | case MON_2: |
@@ -513,7 +526,7 @@ nl_langinfo (nl_item item) | |||
513 | static char result[12][30]; | 526 | static char result[12][30]; |
514 | static char const abmonths[][sizeof "Jan"] = { | 527 | static char const abmonths[][sizeof "Jan"] = { |
515 | "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", | 528 | "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", |
516 | "Sep", "Oct", "Nov", "Dec" | 529 | "Aug", "Sep", "Oct", "Nov", "Dec" |
517 | }; | 530 | }; |
518 | tmm.tm_mon = item - ABMON_1; | 531 | tmm.tm_mon = item - ABMON_1; |
519 | if (!strftime (buf, sizeof result[0], "%b", &tmm)) | 532 | if (!strftime (buf, sizeof result[0], "%b", &tmm)) |