Module Name:    src
Committed By:   christos
Date:           Sat Nov 15 17:49:19 UTC 2014

Modified Files:
        src/distrib/utils/libhack: multibyte.c

Log Message:
handle the "special" wc NULL case.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/distrib/utils/libhack/multibyte.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/utils/libhack/multibyte.c
diff -u src/distrib/utils/libhack/multibyte.c:1.5 src/distrib/utils/libhack/multibyte.c:1.6
--- src/distrib/utils/libhack/multibyte.c:1.5	Fri Apr 19 14:45:03 2013
+++ src/distrib/utils/libhack/multibyte.c	Sat Nov 15 12:49:19 2014
@@ -1,4 +1,4 @@
-/*      $NetBSD: multibyte.c,v 1.5 2013/04/19 18:45:03 joerg Exp $      */
+/*      $NetBSD: multibyte.c,v 1.6 2014/11/15 17:49:19 christos Exp $      */
 
 /*
  * Ignore all multibyte sequences, removes all the citrus code.
@@ -12,7 +12,15 @@
 size_t
 mbrtowc(wchar_t *wc, const char *str, size_t max_sz, mbstate_t *ps)
 {
-	return str == NULL || (*wc = (unsigned char)*str) == 0 ? 0 : 1;
+	wchar_t c;
+
+	if (str == NULL)
+		return 0;
+
+	if (wc != NULL)
+		*wc = (unsigned char)*str;
+
+	return *str == '\0' ? 0 : 1;
 }
 
 size_t

Reply via email to