Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src/distrib/utils/libhack Pull up following revision(s) (requ...



details:   https://anonhg.NetBSD.org/src/rev/29f98efb183c
branches:  netbsd-7
changeset: 798594:29f98efb183c
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Nov 16 10:39:54 2014 +0000

description:
Pull up following revision(s) (requested by christos in ticket #242):
        distrib/utils/libhack/multibyte.c: revision 1.6
handle the "special" wc NULL case.

diffstat:

 distrib/utils/libhack/multibyte.c |  12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r 7a993a916817 -r 29f98efb183c distrib/utils/libhack/multibyte.c
--- a/distrib/utils/libhack/multibyte.c Sun Nov 16 10:33:57 2014 +0000
+++ b/distrib/utils/libhack/multibyte.c Sun Nov 16 10:39:54 2014 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: multibyte.c,v 1.5 2013/04/19 18:45:03 joerg Exp $      */
+/*      $NetBSD: multibyte.c,v 1.5.8.1 2014/11/16 10:39:54 martin 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



Home | Main Index | Thread Index | Old Index