diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2009-01-15 18:53:52 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2009-01-15 18:53:52 +0000 |
commit | 68edecb54458a58111725209d5eefba8f2ea01aa (patch) | |
tree | fca663953f11d103ba29a50566b47a332378986c /lib/libc/locale | |
parent | 2d3842287a220a3cdfb3ebdc2a413e5ed57798dd (diff) | |
download | FreeBSD-src-68edecb54458a58111725209d5eefba8f2ea01aa.zip FreeBSD-src-68edecb54458a58111725209d5eefba8f2ea01aa.tar.gz |
Introduce a local variable and use it instead of passed in parameter
to get rid of restrict qualifier discarding. This lets libc compile
cleanly in gnu99 mode.
Suggested by: kib, christoph.mallon at gmx.de
Approved by: kib (mentor)
Diffstat (limited to 'lib/libc/locale')
-rw-r--r-- | lib/libc/locale/mbstowcs.c | 4 | ||||
-rw-r--r-- | lib/libc/locale/wcsftime.c | 6 | ||||
-rw-r--r-- | lib/libc/locale/wcstombs.c | 4 |
3 files changed, 10 insertions, 4 deletions
diff --git a/lib/libc/locale/mbstowcs.c b/lib/libc/locale/mbstowcs.c index ad259d8..194ec2e 100644 --- a/lib/libc/locale/mbstowcs.c +++ b/lib/libc/locale/mbstowcs.c @@ -37,7 +37,9 @@ mbstowcs(wchar_t * __restrict pwcs, const char * __restrict s, size_t n) { static const mbstate_t initial; mbstate_t mbs; + const char *sp; mbs = initial; - return (__mbsnrtowcs(pwcs, &s, SIZE_T_MAX, n, &mbs)); + sp = s; + return (__mbsnrtowcs(pwcs, &sp, SIZE_T_MAX, n, &mbs)); } diff --git a/lib/libc/locale/wcsftime.c b/lib/libc/locale/wcsftime.c index 7a54fc0..22eb389 100644 --- a/lib/libc/locale/wcsftime.c +++ b/lib/libc/locale/wcsftime.c @@ -53,6 +53,7 @@ wcsftime(wchar_t * __restrict wcs, size_t maxsize, static const mbstate_t initial; mbstate_t mbs; char *dst, *dstp, *sformat; + const wchar_t *formatp; size_t n, sflen; int sverrno; @@ -63,13 +64,14 @@ wcsftime(wchar_t * __restrict wcs, size_t maxsize, * for strftime(), which only handles single-byte characters. */ mbs = initial; - sflen = wcsrtombs(NULL, &format, 0, &mbs); + formatp = format; + sflen = wcsrtombs(NULL, &formatp, 0, &mbs); if (sflen == (size_t)-1) goto error; if ((sformat = malloc(sflen + 1)) == NULL) goto error; mbs = initial; - wcsrtombs(sformat, &format, sflen + 1, &mbs); + wcsrtombs(sformat, &formatp, sflen + 1, &mbs); /* * Allocate memory for longest multibyte sequence that will fit diff --git a/lib/libc/locale/wcstombs.c b/lib/libc/locale/wcstombs.c index acd0051..250d2b9 100644 --- a/lib/libc/locale/wcstombs.c +++ b/lib/libc/locale/wcstombs.c @@ -37,7 +37,9 @@ wcstombs(char * __restrict s, const wchar_t * __restrict pwcs, size_t n) { static const mbstate_t initial; mbstate_t mbs; + const wchar_t *pwcsp; mbs = initial; - return (__wcsnrtombs(s, &pwcs, SIZE_T_MAX, n, &mbs)); + pwcsp = pwcs; + return (__wcsnrtombs(s, &pwcsp, SIZE_T_MAX, n, &mbs)); } |