Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Jul 2016 11:25:24 +0000 (UTC)
From:      "Andrey A. Chernov" <ache@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r302944 - head/lib/libc/gen
Message-ID:  <201607171125.u6HBPOpJ074623@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ache
Date: Sun Jul 17 11:25:24 2016
New Revision: 302944
URL: https://svnweb.freebsd.org/changeset/base/302944

Log:
  In g_Ctoc() apply CHAR() macro to *str to strip all flags. It gains nothing
  right now, but some architectures theoretically may 64-bit wchar_t and the
  code looks more correct.

Modified:
  head/lib/libc/gen/glob.c

Modified: head/lib/libc/gen/glob.c
==============================================================================
--- head/lib/libc/gen/glob.c	Sun Jul 17 09:39:59 2016	(r302943)
+++ head/lib/libc/gen/glob.c	Sun Jul 17 11:25:24 2016	(r302944)
@@ -979,14 +979,14 @@ g_Ctoc(const Char *str, char *buf, size_
 
 	memset(&mbs, 0, sizeof(mbs));
 	while (len >= MB_CUR_MAX) {
-		clen = wcrtomb(buf, *str, &mbs);
+		clen = wcrtomb(buf, CHAR(*str), &mbs);
 		if (clen == (size_t)-1) {
 			/* XXX See initial comment #2. */
-			*buf = (char)*str;
+			*buf = (char)CHAR(*str);
 			clen = 1;
 			memset(&mbs, 0, sizeof(mbs));
 		}
-		if (*buf == '\0')
+		if (CHAR(*str) == EOS)
 			return (0);
 		str++;
 		buf += clen;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607171125.u6HBPOpJ074623>