style(9): use NULL when assigning/comparing a char *,
consitently compare fileid with 0 using == and !=. Reviewed by: silence on @audit
This commit is contained in:
parent
7d2101965f
commit
7f10745771
@ -142,7 +142,7 @@ setpath(struct pathhead *pathq)
|
||||
if (sysctl(mib, miblen, NULL, NULL, newpath, strlen(newpath)+1) == -1)
|
||||
err(1, "setting path: sysctl(%s)", pathctl);
|
||||
|
||||
if (modpath)
|
||||
if (modpath != NULL)
|
||||
free(modpath);
|
||||
modpath = newpath;
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ main(int argc, char** argv)
|
||||
int c;
|
||||
int verbose = 0;
|
||||
int fileid = 0;
|
||||
char* filename = 0;
|
||||
char* filename = NULL;
|
||||
|
||||
while ((c = getopt(argc, argv, "i:n:v")) != -1)
|
||||
switch (c) {
|
||||
@ -114,13 +114,13 @@ main(int argc, char** argv)
|
||||
if (argc != 0)
|
||||
usage();
|
||||
|
||||
if (filename) {
|
||||
if (filename != NULL) {
|
||||
if ((fileid = kldfind(filename)) < 0)
|
||||
err(1, "can't find file %s", filename);
|
||||
}
|
||||
|
||||
printf("Id Refs Address%*c Size Name\n", POINTER_WIDTH - 7, ' ');
|
||||
if (fileid)
|
||||
if (fileid != 0)
|
||||
printfile(fileid, verbose);
|
||||
else
|
||||
for (fileid = kldnext(0); fileid > 0; fileid = kldnext(fileid))
|
||||
|
@ -50,7 +50,7 @@ main(int argc, char** argv)
|
||||
int c;
|
||||
int verbose = 0;
|
||||
int fileid = 0;
|
||||
char* filename = 0;
|
||||
char* filename = NULL;
|
||||
|
||||
while ((c = getopt(argc, argv, "i:n:v")) != -1)
|
||||
switch (c) {
|
||||
@ -71,18 +71,18 @@ main(int argc, char** argv)
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
if (!fileid && !filename && (argc == 1)) {
|
||||
if (fileid == 0 && filename == NULL && (argc == 1)) {
|
||||
filename = *argv;
|
||||
argc--;
|
||||
}
|
||||
|
||||
if (argc != 0 || (fileid && filename))
|
||||
if (argc != 0 || (fileid != 0 && filename != NULL))
|
||||
usage();
|
||||
|
||||
if (fileid == 0 && filename == 0)
|
||||
if (fileid == 0 && filename == NULL)
|
||||
usage();
|
||||
|
||||
if (filename) {
|
||||
if (filename != NULL) {
|
||||
if ((fileid = kldfind(filename)) < 0)
|
||||
err(1, "can't find file %s", filename);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user