From owner-svn-src-all@FreeBSD.ORG Thu Jan 15 18:53:52 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 909741065713; Thu, 15 Jan 2009 18:53:52 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7D4CC8FC1A; Thu, 15 Jan 2009 18:53:52 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0FIrqI1084394; Thu, 15 Jan 2009 18:53:52 GMT (envelope-from rdivacky@svn.freebsd.org) Received: (from rdivacky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0FIrqjN084389; Thu, 15 Jan 2009 18:53:52 GMT (envelope-from rdivacky@svn.freebsd.org) Message-Id: <200901151853.n0FIrqjN084389@svn.freebsd.org> From: Roman Divacky Date: Thu, 15 Jan 2009 18:53:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187302 - in head/lib/libc: locale stdio X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jan 2009 18:53:53 -0000 Author: rdivacky Date: Thu Jan 15 18:53:52 2009 New Revision: 187302 URL: http://svn.freebsd.org/changeset/base/187302 Log: 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) Modified: head/lib/libc/locale/mbstowcs.c head/lib/libc/locale/wcsftime.c head/lib/libc/locale/wcstombs.c head/lib/libc/stdio/fputws.c head/lib/libc/stdio/vswscanf.c Modified: head/lib/libc/locale/mbstowcs.c ============================================================================== --- head/lib/libc/locale/mbstowcs.c Thu Jan 15 18:31:36 2009 (r187301) +++ head/lib/libc/locale/mbstowcs.c Thu Jan 15 18:53:52 2009 (r187302) @@ -37,7 +37,9 @@ mbstowcs(wchar_t * __restrict pwcs, cons { 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)); } Modified: head/lib/libc/locale/wcsftime.c ============================================================================== --- head/lib/libc/locale/wcsftime.c Thu Jan 15 18:31:36 2009 (r187301) +++ head/lib/libc/locale/wcsftime.c Thu Jan 15 18:53:52 2009 (r187302) @@ -53,6 +53,7 @@ wcsftime(wchar_t * __restrict wcs, size_ 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_ * 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 Modified: head/lib/libc/locale/wcstombs.c ============================================================================== --- head/lib/libc/locale/wcstombs.c Thu Jan 15 18:31:36 2009 (r187301) +++ head/lib/libc/locale/wcstombs.c Thu Jan 15 18:53:52 2009 (r187302) @@ -37,7 +37,9 @@ wcstombs(char * __restrict s, const wcha { 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)); } Modified: head/lib/libc/stdio/fputws.c ============================================================================== --- head/lib/libc/stdio/fputws.c Thu Jan 15 18:31:36 2009 (r187301) +++ head/lib/libc/stdio/fputws.c Thu Jan 15 18:53:52 2009 (r187302) @@ -45,6 +45,7 @@ fputws(const wchar_t * __restrict ws, FI char buf[BUFSIZ]; struct __suio uio; struct __siov iov; + const wchar_t *wsp; FLOCKFILE(fp); ORIENT(fp, 1); @@ -54,7 +55,8 @@ fputws(const wchar_t * __restrict ws, FI uio.uio_iovcnt = 1; iov.iov_base = buf; do { - nbytes = __wcsnrtombs(buf, &ws, SIZE_T_MAX, sizeof(buf), + wsp = ws; + nbytes = __wcsnrtombs(buf, &wsp, SIZE_T_MAX, sizeof(buf), &fp->_mbstate); if (nbytes == (size_t)-1) goto error; Modified: head/lib/libc/stdio/vswscanf.c ============================================================================== --- head/lib/libc/stdio/vswscanf.c Thu Jan 15 18:31:36 2009 (r187301) +++ head/lib/libc/stdio/vswscanf.c Thu Jan 15 18:53:52 2009 (r187302) @@ -66,6 +66,7 @@ vswscanf(const wchar_t * __restrict str, char *mbstr; size_t mlen; int r; + const wchar_t *strp; /* * XXX Convert the wide character string to multibyte, which @@ -74,7 +75,8 @@ vswscanf(const wchar_t * __restrict str, if ((mbstr = malloc(wcslen(str) * MB_CUR_MAX + 1)) == NULL) return (EOF); mbs = initial; - if ((mlen = wcsrtombs(mbstr, &str, SIZE_T_MAX, &mbs)) == (size_t)-1) { + strp = str; + if ((mlen = wcsrtombs(mbstr, &strp, SIZE_T_MAX, &mbs)) == (size_t)-1) { free(mbstr); return (EOF); }