]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
a pointer should not be compared to zero [coccinelle]
authorSami Kerola <kerolasa@iki.fi>
Wed, 30 Jan 2013 20:33:23 +0000 (20:33 +0000)
committerKarel Zak <kzak@redhat.com>
Wed, 6 Feb 2013 10:51:15 +0000 (11:51 +0100)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
lib/ismounted.c
libblkid/src/devno.c
misc-utils/whereis.c
mount-deprecated/mount.c
term-utils/agetty.c
text-utils/more.c

index 5611ab3855e722105dcb911430f3a7d3d3ad05a5..d9f1f57d00a9ff7175a0421314dd61de5301301f 100644 (file)
@@ -91,7 +91,7 @@ static int check_mntent_file(const char *mtab_file, const char *file,
                }
        }
 
-       if (mnt == 0) {
+       if (mnt == NULL) {
 #ifndef __GNU__ /* The GNU hurd is broken with respect to stat devices */
                /*
                 * Do an extra check to see if this is the root device.  We
index c54903566fb9a5d721cc78b6ee4ecf816f01fb83..906c91fcd6767b20c3a5f2130522068ccade27b5 100644 (file)
@@ -115,7 +115,7 @@ void blkid__scan_dir(char *dirname, dev_t devno, struct dir_list **list,
        if ((dir = opendir(dirname)) == NULL)
                return;
 
-       while ((dp = readdir(dir)) != 0) {
+       while ((dp = readdir(dir)) != NULL) {
 #ifdef _DIRENT_HAVE_D_TYPE
                if (dp->d_type != DT_UNKNOWN && dp->d_type != DT_BLK &&
                    dp->d_type != DT_LNK && dp->d_type != DT_DIR)
index d253f375dde0d34fbf708f87001ec3897e4e4e12..4194ad5dc8d33f24bb1759e7c35f70d3ef10003d 100644 (file)
@@ -304,7 +304,7 @@ findv(char **dirv, int dirc, char *cp)
 static void
 looksrc(char *cp)
 {
-       if (Sflag == 0)
+       if (Sflag == NULL)
                findv(srcdirs, ARRAY_SIZE(srcdirs)-1, cp);
        else
                findv(Sflag, Scnt, cp);
@@ -313,7 +313,7 @@ looksrc(char *cp)
 static void
 lookbin(char *cp)
 {
-       if (Bflag == 0) {
+       if (Bflag == NULL) {
                findv(bindirs, ARRAY_SIZE(bindirs)-1, cp);
                while (*pathdir_p)
                        findin(*pathdir_p++, cp);               /* look $PATH */
@@ -324,7 +324,7 @@ lookbin(char *cp)
 static void
 lookman(char *cp)
 {
-       if (Mflag == 0)
+       if (Mflag == NULL)
                findv(mandirs, ARRAY_SIZE(mandirs)-1, cp);
        else
                findv(Mflag, Mcnt, cp);
index 3190d2f8b07188df5b17290634876778f72bdd12..5031683b9139556a5538219278f32d3b39b1d72c 100644 (file)
@@ -1668,7 +1668,7 @@ try_mount_one (const char *spec0, const char *node0, const char *types0,
 
   /* Mount failed, complain, but don't die.  */
 
-  if (types == 0) {
+  if (types == NULL) {
     if (restricted)
       error (_("mount: I could not determine the filesystem type, "
               "and none was specified"));
index c79c41665a0cbd41c820498d99e5433c91feb432..b9a14b3285121f33caa610b57c0f0e630200a7b4 100644 (file)
@@ -358,7 +358,7 @@ int main(int argc, char **argv)
                        /* Read the login name. */
                        debug("reading login name\n");
                        while ((username =
-                               get_logname(&options, &termios, &chardata)) == 0)
+                               get_logname(&options, &termios, &chardata)) == NULL)
                                if ((options.flags & F_VCONSOLE) == 0)
                                        next_speed(&options, &termios);
                }
@@ -747,7 +747,7 @@ static void parse_speeds(struct options *op, char *arg)
        char *cp;
 
        debug("entered parse_speeds\n");
-       for (cp = strtok(arg, ","); cp != 0; cp = strtok((char *)0, ",")) {
+       for (cp = strtok(arg, ","); cp != NULL; cp = strtok((char *)0, ",")) {
                if ((op->speeds[op->numspeed++] = bcode(cp)) <= 0)
                        log_err(_("bad speed: %s"), cp);
                if (op->numspeed >= MAX_SPEED)
index 2ebdd75ef1cd02bd85ae7c7166bac173251f931d..496b1168f432405dd2e60743324cc850c74cf336 100644 (file)
@@ -1785,7 +1785,7 @@ void initterm(void)
                        }
                }
 #endif /* do_SIGTTOU */
-               if ((term = getenv("TERM")) == 0) {
+               if ((term = getenv("TERM")) == NULL) {
                        dumb++;
                        ul_opt = 0;
                }
@@ -1856,7 +1856,7 @@ void initterm(void)
                        if ((padstr = my_tgetstr(TERM_PAD_CHAR)) != NULL)
                                PC = *padstr;
                        Home = my_tgetstr(TERM_HOME);
-                       if (Home == 0 || *Home == '\0') {
+                       if (Home == NULL || *Home == '\0') {
                                if ((cursorm =
                                     my_tgetstr(TERM_CURSOR_ADDRESS)) != NULL) {
                                        const char *t =