]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfsprogs: don't use 0 as pointer
authorEric Sandeen <sandeen@redhat.com>
Tue, 9 Oct 2018 16:49:47 +0000 (11:49 -0500)
committerEric Sandeen <sandeen@redhat.com>
Tue, 9 Oct 2018 16:49:47 +0000 (11:49 -0500)
Use NULL as appropriate.

Fixes sparse warnings about this.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
db/dir2sf.c
fsr/xfs_fsr.c
libxfs/libxfs_priv.h
libxfs/rdwr.c
mkfs/proto.c
scrub/fscounters.c
scrub/inodes.c

index 977a93239f3534a5413f0dfbc18bd82e1d107ef8..5737f2a31fab78fd0f464464c5872678c8178fa4 100644 (file)
@@ -30,8 +30,8 @@ const field_t dir2sf_flds[] = {
 };
 
 const field_t  dir2_inou_flds[] = {
-       { "i8", FLDT_DIR2_INO8, 0, dir2_inou_i8_count, FLD_COUNT, TYP_INODE },
-       { "i4", FLDT_DIR2_INO4, 0, dir2_inou_i4_count, FLD_COUNT, TYP_INODE },
+       { "i8", FLDT_DIR2_INO8, NULL, dir2_inou_i8_count, FLD_COUNT, TYP_INODE},
+       { "i4", FLDT_DIR2_INO4, NULL, dir2_inou_i4_count, FLD_COUNT, TYP_INODE},
        { NULL }
 };
 
index e21643aeca1ba04eadcaaee70728635d757715aa..c8aea9804e517a0e1e9738ed1b29266b4c92a469 100644 (file)
@@ -241,7 +241,7 @@ main(int argc, char **argv)
        if (vflag)
                setbuf(stdout, NULL);
 
-       starttime = time(0);
+       starttime = time(NULL);
 
        /* Save the caller's real uid */
        RealUid = getuid();
@@ -525,7 +525,7 @@ fsrallfs(char *mtab, int howlong, char *leftofffile)
        signal(SIGTERM, aborter);
 
        /* reorg for 'howlong' -- checked in 'fsrfs' */
-       while (endtime > time(0)) {
+       while (endtime > time(NULL)) {
                pid_t pid;
 
                if (npasses > 1 && !fs->npass)
@@ -560,7 +560,7 @@ fsrallfs(char *mtab, int howlong, char *leftofffile)
                        break;
                }
        }
-       fsrall_cleanup(endtime <= time(0));
+       fsrall_cleanup(endtime <= time(NULL));
 }
 
 /*
@@ -578,7 +578,7 @@ fsrall_cleanup(int timeout)
        if (timeout) {
                fsrprintf(_("%s startpass %d, endpass %d, time %d seconds\n"),
                        progname, startpass, fs->npass,
-                       time(0) - endtime + howlong);
+                       time(NULL) - endtime + howlong);
 
                /* record where we left off */
                fd = open(leftofffile, O_WRONLY|O_CREAT|O_EXCL, 0644);
@@ -688,7 +688,7 @@ fsrfs(char *mntdir, xfs_ino_t startino, int targetrange)
                                        break;
                        }
                }
-               if (endtime && endtime < time(0)) {
+               if (endtime && endtime < time(NULL)) {
                        tmp_close(mntdir);
                        close(fsfd);
                        fsrall_cleanup(1);
index a22ca49d1b6c7eb0c898219b741847d4566a0e30..3005374518f054d5e8dade2164ffceb7948b9604 100644 (file)
@@ -393,7 +393,7 @@ roundup_64(uint64_t x, uint32_t y)
 #define XBRW_READ                      LIBXFS_BREAD
 #define XBRW_WRITE                     LIBXFS_BWRITE
 #define xfs_buf_iomove(bp,off,len,data,f)      libxfs_iomove(bp,off,len,data,f)
-#define xfs_buf_zero(bp,off,len)       libxfs_iomove(bp,off,len,0,LIBXFS_BZERO)
+#define xfs_buf_zero(bp,off,len)     libxfs_iomove(bp,off,len,NULL,LIBXFS_BZERO)
 
 /* mount stuff */
 #define XFS_MOUNT_32BITINODES          LIBXFS_MOUNT_32BITINODES
index 0ee3ba864fb47ea89ede31e7a0ef722c02495fbb..c160e209a260980a419423966fc2bb48290c84a3 100644 (file)
@@ -779,7 +779,7 @@ struct xfs_buf *
 libxfs_getbuf_flags(struct xfs_buftarg *btp, xfs_daddr_t blkno, int len,
                unsigned int flags)
 {
-       struct xfs_bufkey key = {0};
+       struct xfs_bufkey key = {NULL};
 
        key.buftarg = btp;
        key.blkno = blkno;
@@ -822,7 +822,7 @@ static struct xfs_buf *
 __libxfs_getbuf_map(struct xfs_buftarg *btp, struct xfs_buf_map *map,
                    int nmaps, int flags)
 {
-       struct xfs_bufkey key = {0};
+       struct xfs_bufkey key = {NULL};
        int i;
 
        if (nmaps == 1)
@@ -882,7 +882,7 @@ libxfs_putbuf(xfs_buf_t *bp)
 void
 libxfs_purgebuf(xfs_buf_t *bp)
 {
-       struct xfs_bufkey key = {0};
+       struct xfs_bufkey key = {NULL};
 
        key.buftarg = bp->b_target;
        key.blkno = bp->b_bn;
index 687c53ab7e3761bb344ba2bb5784172e8b7fae49..1cd5436b992cab8c8468e38ef5f86930d0d3e245 100644 (file)
@@ -259,7 +259,7 @@ newfile(
                        exit(1);
                }
                d = XFS_FSB_TO_DADDR(mp, map.br_startblock);
-               bp = libxfs_trans_get_buf(logit ? tp : 0, mp->m_dev, d,
+               bp = libxfs_trans_get_buf(logit ? tp : NULL, mp->m_dev, d,
                        nb << mp->m_blkbb_log, 0);
                memmove(bp->b_addr, buf, len);
                if (len < bp->b_bcount)
@@ -297,7 +297,7 @@ newregfile(
                        exit(1);
                }
        } else
-               buf = 0;
+               buf = NULL;
        close(fd);
        return buf;
 }
index 6e9bd05dbdba7db2adbe2860bf7fb259293987e6..9e93e2a6feb318dec0de6b76ef0013da83843675 100644 (file)
@@ -41,7 +41,7 @@ xfs_count_inodes_range(
        uint64_t                last_ino,
        uint64_t                *count)
 {
-       struct xfs_fsop_bulkreq igrpreq = {0};
+       struct xfs_fsop_bulkreq igrpreq = {NULL};
        struct xfs_inogrp       inogrp;
        __u64                   igrp_ino;
        uint64_t                nr = 0;
index add6876e0c0df16641b600a6a1214a9514c05784..693f21ec01ad2931a746d1cf5c1e8b83b93d4d16 100644 (file)
@@ -50,7 +50,7 @@ xfs_iterate_inodes_range_check(
        struct xfs_inogrp       *inogrp,
        struct xfs_bstat        *bstat)
 {
-       struct xfs_fsop_bulkreq onereq = {0};
+       struct xfs_fsop_bulkreq onereq = {NULL};
        struct xfs_bstat        *bs;
        __u64                   oneino;
        __s32                   onelen = 0;
@@ -98,8 +98,8 @@ xfs_iterate_inodes_range(
        xfs_inode_iter_fn       fn,
        void                    *arg)
 {
-       struct xfs_fsop_bulkreq igrpreq = {0};
-       struct xfs_fsop_bulkreq bulkreq = {0};
+       struct xfs_fsop_bulkreq igrpreq = {NULL};
+       struct xfs_fsop_bulkreq bulkreq = {NULL};
        struct xfs_handle       handle;
        struct xfs_inogrp       inogrp;
        struct xfs_bstat        bstat[XFS_INODES_PER_CHUNK];