summaryrefslogtreecommitdiffstats
path: root/gl/setlocale_null-unlocked.c
diff options
context:
space:
mode:
Diffstat (limited to 'gl/setlocale_null-unlocked.c')
-rw-r--r--gl/setlocale_null-unlocked.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/gl/setlocale_null-unlocked.c b/gl/setlocale_null-unlocked.c
index 72729e6b..e7f155c7 100644
--- a/gl/setlocale_null-unlocked.c
+++ b/gl/setlocale_null-unlocked.c
@@ -1,5 +1,5 @@
1/* Query the name of the current global locale, without locking. 1/* Query the name of the current global locale, without locking.
2 Copyright (C) 2019-2025 Free Software Foundation, Inc. 2 Copyright (C) 2019-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -86,10 +86,8 @@ setlocale_null_r_unlocked (int category, char *buf, size_t bufsize)
86 size_t length = wcslen (result); 86 size_t length = wcslen (result);
87 if (length < bufsize) 87 if (length < bufsize)
88 { 88 {
89 size_t i;
90
91 /* Convert wchar_t[] -> char[], assuming plain ASCII. */ 89 /* Convert wchar_t[] -> char[], assuming plain ASCII. */
92 for (i = 0; i <= length; i++) 90 for (size_t i = 0; i <= length; i++)
93 buf[i] = result[i]; 91 buf[i] = result[i];
94 92
95 return 0; 93 return 0;
@@ -101,10 +99,8 @@ setlocale_null_r_unlocked (int category, char *buf, size_t bufsize)
101 /* Return a truncated result in BUF. 99 /* Return a truncated result in BUF.
102 This is a convenience for callers that don't want to write 100 This is a convenience for callers that don't want to write
103 explicit code for handling ERANGE. */ 101 explicit code for handling ERANGE. */
104 size_t i;
105
106 /* Convert wchar_t[] -> char[], assuming plain ASCII. */ 102 /* Convert wchar_t[] -> char[], assuming plain ASCII. */
107 for (i = 0; i < bufsize; i++) 103 for (size_t i = 0; i < bufsize; i++)
108 buf[i] = result[i]; 104 buf[i] = result[i];
109 buf[bufsize - 1] = '\0'; 105 buf[bufsize - 1] = '\0';
110 } 106 }