From owner-svn-src-head@freebsd.org Tue Feb 13 19:17:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB3DAF1C0EB; Tue, 13 Feb 2018 19:17:49 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 61A206B2FE; Tue, 13 Feb 2018 19:17:49 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 43CEB24F05; Tue, 13 Feb 2018 19:17:49 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1DJHnRd047469; Tue, 13 Feb 2018 19:17:49 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1DJHmso047463; Tue, 13 Feb 2018 19:17:48 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201802131917.w1DJHmso047463@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 13 Feb 2018 19:17:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329237 - head/sys/libkern X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/libkern X-SVN-Commit-Revision: 329237 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 19:17:50 -0000 Author: emaste Date: Tue Feb 13 19:17:48 2018 New Revision: 329237 URL: https://svnweb.freebsd.org/changeset/base/329237 Log: libkern: use nul for terminating char rather than 0 Akin to the change made in r188080 for lib/libc/string/. Reported by: bde Sponsored by: The FreeBSD Foundation Modified: head/sys/libkern/strcmp.c head/sys/libkern/strncat.c head/sys/libkern/strncpy.c head/sys/libkern/strsep.c head/sys/libkern/strstr.c Modified: head/sys/libkern/strcmp.c ============================================================================== --- head/sys/libkern/strcmp.c Tue Feb 13 19:17:33 2018 (r329236) +++ head/sys/libkern/strcmp.c Tue Feb 13 19:17:48 2018 (r329237) @@ -44,7 +44,7 @@ int strcmp(const char *s1, const char *s2) { while (*s1 == *s2++) - if (*s1++ == 0) + if (*s1++ == '\0') return (0); return (*(const unsigned char *)s1 - *(const unsigned char *)(s2 - 1)); } Modified: head/sys/libkern/strncat.c ============================================================================== --- head/sys/libkern/strncat.c Tue Feb 13 19:17:33 2018 (r329236) +++ head/sys/libkern/strncat.c Tue Feb 13 19:17:48 2018 (r329237) @@ -53,11 +53,11 @@ strncat(char *dst, const char *src, size_t n) while (*d != 0) d++; do { - if ((*d = *s++) == 0) + if ((*d = *s++) == '\0') break; d++; } while (--n != 0); - *d = 0; + *d = '\0'; } return (dst); } Modified: head/sys/libkern/strncpy.c ============================================================================== --- head/sys/libkern/strncpy.c Tue Feb 13 19:17:33 2018 (r329236) +++ head/sys/libkern/strncpy.c Tue Feb 13 19:17:48 2018 (r329237) @@ -49,10 +49,10 @@ strncpy(char * __restrict dst, const char * __restrict const char *s = src; do { - if ((*d++ = *s++) == 0) { + if ((*d++ = *s++) == '\0') { /* NUL pad the remaining n-1 bytes */ while (--n != 0) - *d++ = 0; + *d++ = '\0'; break; } } while (--n != 0); Modified: head/sys/libkern/strsep.c ============================================================================== --- head/sys/libkern/strsep.c Tue Feb 13 19:17:33 2018 (r329236) +++ head/sys/libkern/strsep.c Tue Feb 13 19:17:48 2018 (r329237) @@ -64,14 +64,14 @@ strsep(char **stringp, const char *delim) spanp = delim; do { if ((sc = *spanp++) == c) { - if (c == 0) + if (c == '\0') s = NULL; else - s[-1] = 0; + s[-1] = '\0'; *stringp = s; return (tok); } - } while (sc != 0); + } while (sc != '\0'); } /* NOTREACHED */ } Modified: head/sys/libkern/strstr.c ============================================================================== --- head/sys/libkern/strstr.c Tue Feb 13 19:17:33 2018 (r329236) +++ head/sys/libkern/strstr.c Tue Feb 13 19:17:48 2018 (r329237) @@ -51,7 +51,7 @@ strstr(const char *s, const char *find) len = strlen(find); do { do { - if ((sc = *s++) == 0) + if ((sc = *s++) == '\0') return (NULL); } while (sc != c); } while (strncmp(s, find, len) != 0);