path: root/src/locale
diff options
authorRich Felker <>2012-09-06 22:44:55 -0400
committerRich Felker <>2012-09-06 22:44:55 -0400
commit400c5e5c8307a2ebe44ef1f203f5a15669f20347 (patch)
tree087a48dc8251fa05f6866af8ebf96b69450b15ab /src/locale
parentbac03cdde1137c16b4c194e137310e2748661dcc (diff)
use restrict everywhere it's required by c99 and/or posix 2008
to deal with the fact that the public headers may be used with pre-c99 compilers, __restrict is used in place of restrict, and defined appropriately for any supported compiler. we also avoid the form [restrict] since older versions of gcc rejected it due to a bug in the original c99 standard, and instead use the form *restrict.
Diffstat (limited to 'src/locale')
7 files changed, 8 insertions, 8 deletions
diff --git a/src/locale/iconv.c b/src/locale/iconv.c
index 508d322e..7b341fe9 100644
--- a/src/locale/iconv.c
+++ b/src/locale/iconv.c
@@ -139,7 +139,7 @@ static void put_32(unsigned char *s, unsigned c, int e)
#define mbrtowc_utf8 mbrtowc
#define wctomb_utf8 wctomb
-size_t iconv(iconv_t cd0, char **in, size_t *inb, char **out, size_t *outb)
+size_t iconv(iconv_t cd0, char **restrict in, size_t *restrict inb, char **restrict out, size_t *restrict outb)
size_t x=0;
unsigned long cd = (unsigned long)cd0;
diff --git a/src/locale/strfmon.c b/src/locale/strfmon.c
index 81dfe38f..f510d9a4 100644
--- a/src/locale/strfmon.c
+++ b/src/locale/strfmon.c
@@ -75,7 +75,7 @@ static ssize_t vstrfmon_l(char *s, size_t n, locale_t loc, const char *fmt, va_l
return s-s0;
-ssize_t strfmon_l(char *s, size_t n, locale_t loc, const char *fmt, ...)
+ssize_t strfmon_l(char *restrict s, size_t n, locale_t loc, const char *restrict fmt, ...)
va_list ap;
ssize_t ret;
@@ -88,7 +88,7 @@ ssize_t strfmon_l(char *s, size_t n, locale_t loc, const char *fmt, ...)
-ssize_t strfmon(char *s, size_t n, const char *fmt, ...)
+ssize_t strfmon(char *restrict s, size_t n, const char *restrict fmt, ...)
va_list ap;
ssize_t ret;
diff --git a/src/locale/strftime_l.c b/src/locale/strftime_l.c
index 70b2f151..f19f5bf3 100644
--- a/src/locale/strftime_l.c
+++ b/src/locale/strftime_l.c
@@ -1,7 +1,7 @@
#include <locale.h>
#include <time.h>
-size_t strftime_l(char *s, size_t n, const char *f, const struct tm *tm, locale_t l)
+size_t strftime_l(char *restrict s, size_t n, const char *restrict f, const struct tm *restrict tm, locale_t l)
return strftime(s, n, f, tm);
diff --git a/src/locale/strxfrm.c b/src/locale/strxfrm.c
index 8f123399..d40be9e1 100644
--- a/src/locale/strxfrm.c
+++ b/src/locale/strxfrm.c
@@ -1,7 +1,7 @@
#include <string.h>
/* collate only by code points */
-size_t strxfrm(char *dest, const char *src, size_t n)
+size_t strxfrm(char *restrict dest, const char *restrict src, size_t n)
size_t l = strlen(src);
if (n > l) strcpy(dest, src);
diff --git a/src/locale/strxfrm_l.c b/src/locale/strxfrm_l.c
index 78e56554..81a7badf 100644
--- a/src/locale/strxfrm_l.c
+++ b/src/locale/strxfrm_l.c
@@ -1,6 +1,6 @@
#include <string.h>
-size_t strxfrm_l(char *dest, const char *src, size_t n, locale_t l)
+size_t strxfrm_l(char *restrict dest, const char *restrict src, size_t n, locale_t l)
return strxfrm(dest, src, n);
diff --git a/src/locale/wcsxfrm.c b/src/locale/wcsxfrm.c
index 5f76e5a7..bfa01b5b 100644
--- a/src/locale/wcsxfrm.c
+++ b/src/locale/wcsxfrm.c
@@ -1,7 +1,7 @@
#include <wchar.h>
/* collate only by code points */
-size_t wcsxfrm(wchar_t *dest, const wchar_t *src, size_t n)
+size_t wcsxfrm(wchar_t *restrict dest, const wchar_t *restrict src, size_t n)
size_t l = wcslen(src);
if (l >= n) {
diff --git a/src/locale/wcsxfrm_l.c b/src/locale/wcsxfrm_l.c
index 831998e9..66a00193 100644
--- a/src/locale/wcsxfrm_l.c
+++ b/src/locale/wcsxfrm_l.c
@@ -1,6 +1,6 @@
#include <wchar.h>
-size_t wcsxfrm_l(wchar_t *dest, const wchar_t *src, size_t n, locale_t locale)
+size_t wcsxfrm_l(wchar_t *restrict dest, const wchar_t *restrict src, size_t n, locale_t locale)
return wcsxfrm(dest, src, n);