git: 2763a0928aee - main - config: style for '\0' and NULL
Warner Losh
imp at FreeBSD.org
Mon Apr 19 22:10:18 UTC 2021
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=2763a0928aeedc3c76b0953af9fa7b948026d81b
commit 2763a0928aeedc3c76b0953af9fa7b948026d81b
Author: Warner Losh <imp at FreeBSD.org>
AuthorDate: 2021-04-19 22:09:42 +0000
Commit: Warner Losh <imp at FreeBSD.org>
CommitDate: 2021-04-19 22:10:12 +0000
config: style for '\0' and NULL
Use NULL for pointers instead of '0' (though hey are the same thing in
these cases). Ditto for using the zero character '\0' instead of a naked
0 (ditto).
Reviewed by: markj@
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D29847
---
usr.sbin/config/mkmakefile.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c
index 00eb3422d1d0..4f3bd13ffca3 100644
--- a/usr.sbin/config/mkmakefile.c
+++ b/usr.sbin/config/mkmakefile.c
@@ -193,7 +193,7 @@ sanitize_envline(char *result, const char *src)
/* If there is no '=' it's not a well-formed name=value line. */
if ((eq = strchr(src, '=')) == NULL) {
- *result = 0;
+ *result = '\0';
return;
}
dst = result;
@@ -210,7 +210,7 @@ sanitize_envline(char *result, const char *src)
/* If it was all leading space, we don't have a well-formed line. */
if (leading) {
- *result = 0;
+ *result = '\0';
return;
}
@@ -221,7 +221,7 @@ sanitize_envline(char *result, const char *src)
/* Copy chars after the '=', skipping any leading whitespace. */
leading = true;
- while ((c = *src++) != 0) {
+ while ((c = *src++) != '\0') {
if (leading && (isspace(c) || c == '"'))
continue;
*dst++ = c;
@@ -230,7 +230,7 @@ sanitize_envline(char *result, const char *src)
/* If it was all leading space, it's a valid 'var=' (nil value). */
if (leading) {
- *dst = 0;
+ *dst = '\0';
return;
}
@@ -238,7 +238,7 @@ sanitize_envline(char *result, const char *src)
while (isspace(dst[-1]) || dst[-1] == '"')
--dst;
- *dst = 0;
+ *dst = '\0';
}
/*
@@ -444,10 +444,10 @@ next:
compile = 0;
match = 1;
nreqs = 0;
- compilewith = 0;
- depends = 0;
- clean = 0;
- warning = 0;
+ compilewith = NULL;
+ depends = NULL;
+ clean = NULL;
+ warning = NULL;
std = 0;
imp_rule = 0;
no_ctfconvert = 0;
More information about the dev-commits-src-all
mailing list