svn commit: r302944 - head/lib/libc/gen

Andrey A. Chernov ache at FreeBSD.org
Sun Jul 17 11:25:25 UTC 2016


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;


More information about the svn-src-head mailing list