Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/citrus Redo previous: catch NULL pointer earlier, c...



details:   https://anonhg.NetBSD.org/src/rev/620995c27ca4
branches:  trunk
changeset: 825420:620995c27ca4
user:      joerg <joerg%NetBSD.org@localhost>
date:      Thu Jul 13 15:46:26 2017 +0000

description:
Redo previous: catch NULL pointer earlier, check for empty string
latter.

diffstat:

 lib/libc/citrus/citrus_none.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 301a5894d5a7 -r 620995c27ca4 lib/libc/citrus/citrus_none.c
--- a/lib/libc/citrus/citrus_none.c     Thu Jul 13 15:44:45 2017 +0000
+++ b/lib/libc/citrus/citrus_none.c     Thu Jul 13 15:46:26 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: citrus_none.c,v 1.20 2017/07/13 15:44:45 joerg Exp $   */
+/*     $NetBSD: citrus_none.c,v 1.21 2017/07/13 15:46:26 joerg Exp $   */
 
 /*-
  * Copyright (c)2002 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: citrus_none.c,v 1.20 2017/07/13 15:44:45 joerg Exp $");
+__RCSID("$NetBSD: citrus_none.c,v 1.21 2017/07/13 15:46:26 joerg Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <assert.h>
@@ -513,7 +513,7 @@
                           void * __restrict pspriv,
                           size_t * __restrict nresult)
 {
-       if (s == NULL) {
+       if (s == NULL || *s == NULL) {
                *nresult = 0;
                return (0);
        }
@@ -525,7 +525,7 @@
        if (pwc != NULL)
                *pwc = (_wc_t)(unsigned char) **s;
 
-       *nresult = *s == NULL ? 0 : 1;
+       *nresult = **s == '\0' ? 0 : 1;
        return (0);
 }
 



Home | Main Index | Thread Index | Old Index