*: use NULL for null pointers
authorDenys Vlasenko <vda.linux@googlemail.com>
Fri, 5 Mar 2010 13:10:54 +0000 (14:10 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Fri, 5 Mar 2010 13:10:54 +0000 (14:10 +0100)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
19 files changed:
e2fsprogs/old_e2fsprogs/blkid/devname.c
e2fsprogs/old_e2fsprogs/blkid/probe.c
e2fsprogs/old_e2fsprogs/blkid/resolve.c
e2fsprogs/old_e2fsprogs/blkid/tag.c
e2fsprogs/old_e2fsprogs/e2fsck.c
e2fsprogs/old_e2fsprogs/ext2fs/alloc.c
e2fsprogs/old_e2fsprogs/ext2fs/bmap.c
e2fsprogs/old_e2fsprogs/ext2fs/closefs.c
e2fsprogs/old_e2fsprogs/ext2fs/dirblock.c
e2fsprogs/old_e2fsprogs/ext2fs/ext_attr.c
e2fsprogs/old_e2fsprogs/ext2fs/finddev.c
e2fsprogs/old_e2fsprogs/ext2fs/imager.c
e2fsprogs/old_e2fsprogs/ext2fs/mkdir.c
e2fsprogs/old_e2fsprogs/ext2fs/mkjournal.c
e2fsprogs/old_e2fsprogs/ext2fs/namei.c
e2fsprogs/old_e2fsprogs/ext2fs/rw_bitmaps.c
e2fsprogs/old_e2fsprogs/fsck.c
e2fsprogs/old_e2fsprogs/mke2fs.c
shell/ash.c

index 348e5d42e534debff0a2f6288510a058a2482c14..fad92cb3135d55cbedb2599ccde5c3af1e5389aa 100644 (file)
@@ -258,7 +258,7 @@ int blkid_probe_all(blkid_cache cache)
 {
        FILE *proc;
        char line[1024];
-       char ptname0[128], ptname1[128], *ptname = 0;
+       char ptname0[128], ptname1[128], *ptname = NULL;
        char *ptnames[2];
        dev_t devs[2];
        int ma, mi;
index 1f7188e6d67f2bb711d302e11bbfaef9d398d0c9..77bfc737df0265729bc69237fcfd3c768e995291 100644 (file)
@@ -82,7 +82,7 @@ static void set_uuid(blkid_dev dev, uuid_t uuid)
 static void get_ext2_info(blkid_dev dev, unsigned char *buf)
 {
        struct ext2_super_block *es = (struct ext2_super_block *) buf;
-       const char *label = 0;
+       const char *label = NULL;
 
        DBG(DEBUG_PROBE, printf("ext2_sb.compat = %08X:%08X:%08X\n",
                   blkid_le32(es->s_feature_compat),
@@ -168,7 +168,7 @@ static int probe_vfat(int fd __BLKID_ATTR((unused)),
 {
        struct vfat_super_block *vs;
        char serno[10];
-       const char *label = 0;
+       const char *label = NULL;
        int label_len = 0;
 
        vs = (struct vfat_super_block *)buf;
@@ -201,7 +201,7 @@ static int probe_msdos(int fd __BLKID_ATTR((unused)),
 {
        struct msdos_super_block *ms = (struct msdos_super_block *) buf;
        char serno[10];
-       const char *label = 0;
+       const char *label = NULL;
        int label_len = 0;
 
        if (strncmp(ms->ms_label, "NO NAME", 7)) {
@@ -232,7 +232,7 @@ static int probe_xfs(int fd __BLKID_ATTR((unused)),
                     unsigned char *buf)
 {
        struct xfs_super_block *xs;
-       const char *label = 0;
+       const char *label = NULL;
 
        xs = (struct xfs_super_block *)buf;
 
@@ -250,7 +250,7 @@ static int probe_reiserfs(int fd __BLKID_ATTR((unused)),
 {
        struct reiserfs_super_block *rs = (struct reiserfs_super_block *) buf;
        unsigned int blocksize;
-       const char *label = 0;
+       const char *label = NULL;
 
        blocksize = blkid_le16(rs->rs_blocksize);
 
@@ -277,7 +277,7 @@ static int probe_jfs(int fd __BLKID_ATTR((unused)),
                     unsigned char *buf)
 {
        struct jfs_super_block *js;
-       const char *label = 0;
+       const char *label = NULL;
 
        js = (struct jfs_super_block *)buf;
 
@@ -295,7 +295,7 @@ static int probe_romfs(int fd __BLKID_ATTR((unused)),
                       unsigned char *buf)
 {
        struct romfs_super_block *ros;
-       const char *label = 0;
+       const char *label = NULL;
 
        ros = (struct romfs_super_block *)buf;
 
@@ -312,7 +312,7 @@ static int probe_cramfs(int fd __BLKID_ATTR((unused)),
                       unsigned char *buf)
 {
        struct cramfs_super_block *csb;
-       const char *label = 0;
+       const char *label = NULL;
 
        csb = (struct cramfs_super_block *)buf;
 
index 0f92158e252b35e6aa52038d6c1dec299b98e17b..295ca61bffff3aac6e4f20d73d08757862471137 100644 (file)
@@ -65,7 +65,7 @@ char *blkid_get_devname(blkid_cache cache, const char *token,
 {
        blkid_dev dev;
        blkid_cache c = cache;
-       char *t = 0, *v = 0;
+       char *t = NULL, *v = NULL;
        char *ret = NULL;
 
        if (!token)
index c0a93df98fcb3f7224a0bf71e567649e516fe074..8337b46b6b30da8fec47a1a05356aebb6901efa6 100644 (file)
@@ -112,7 +112,7 @@ int blkid_set_tag(blkid_dev dev, const char *name,
                  const char *value, const int vlength)
 {
        blkid_tag       t = 0, head = 0;
-       char            *val = 0;
+       char            *val = NULL;
 
        if (!dev || !name)
                return -BLKID_ERR_PARAM;
index 7e0996956eefaac909d5c769e564d7bbf67c3be3..7384bc45376dfc7c3adcb446a6e6f0a3c92e2b60 100644 (file)
@@ -1539,7 +1539,7 @@ static errcode_t e2fsck_get_journal(e2fsck_t ctx, journal_t **ret_journal)
        struct buffer_head      *bh;
        struct inode            *j_inode = NULL;
        struct kdev_s           *dev_fs = NULL, *dev_journal;
-       const char              *journal_name = 0;
+       const char              *journal_name = NULL;
        journal_t               *journal = NULL;
        errcode_t               retval = 0;
        io_manager              io_ptr = 0;
@@ -6009,7 +6009,7 @@ static int check_dir_block(ext2_filsys fs,
        struct dir_info         *subdir, *dir;
        struct dx_dir_info      *dx_dir;
 #ifdef ENABLE_HTREE
-       struct dx_dirblock_info *dx_db = 0;
+       struct dx_dirblock_info *dx_db = NULL;
 #endif /* ENABLE_HTREE */
        struct ext2_dir_entry   *dirent, *prev;
        ext2_dirhash_t          hash;
@@ -7524,7 +7524,7 @@ static void e2fsck_pass4(e2fsck_t ctx)
        struct ext2_inode       inode;
        struct problem_context  pctx;
        __u16   link_count, link_counted;
-       char    *buf = 0;
+       char    *buf = NULL;
        int     group, maxgroup;
 
        /* Pass 4 */
@@ -9670,7 +9670,7 @@ int fix_problem(e2fsck_t ctx, problem_t code, struct problem_context *pctx)
 {
        ext2_filsys fs = ctx->fs;
        const struct e2fsck_problem *ptr;
-       struct latch_descr *ldesc = 0;
+       struct latch_descr *ldesc = NULL;
        const char *message;
        int             def_yn, answer, ans;
        int             print_answer = 0;
@@ -10669,7 +10669,7 @@ static errcode_t calculate_tree(ext2_filsys fs,
                                ext2_ino_t parent)
 {
        struct ext2_dx_root_info        *root_info;
-       struct ext2_dx_entry            *root, *dx_ent = 0;
+       struct ext2_dx_entry            *root, *dx_ent = NULL;
        struct ext2_dx_countlimit       *root_limit, *limit;
        errcode_t                       retval;
        char                            * block_start;
@@ -10821,7 +10821,7 @@ static errcode_t e2fsck_rehash_dir(e2fsck_t ctx, ext2_ino_t ino)
        ext2_filsys             fs = ctx->fs;
        errcode_t               retval;
        struct ext2_inode       inode;
-       char                    *dir_buf = 0;
+       char                    *dir_buf = NULL;
        struct fill_dir_struct  fd;
        struct out_dir          outdir;
 
@@ -11559,7 +11559,7 @@ static void check_resize_inode(e2fsck_t ctx)
        struct problem_context  pctx;
        int             i, j, gdt_off, ind_off;
        blk_t           blk, pblk, expect;
-       __u32           *dind_buf = 0, *ind_buf;
+       __u32           *dind_buf = NULL, *ind_buf;
        errcode_t       retval;
 
        clear_problem_context(&pctx);
@@ -12975,7 +12975,7 @@ static errcode_t PRS(int argc, char **argv, e2fsck_t *ret_ctx)
        e2fsck_t        ctx;
        errcode_t       retval;
        struct sigaction        sa;
-       char            *extended_opts = 0;
+       char            *extended_opts = NULL;
 
        retval = e2fsck_allocate_context(&ctx);
        if (retval)
index 590f23a7ee285a546e6603fd60bfde0aa39c9a09..5021d72c9f91509ad44eb6380fe2b4020735e710 100644 (file)
@@ -109,7 +109,7 @@ errcode_t ext2fs_alloc_block(ext2_filsys fs, blk_t goal,
 {
        errcode_t       retval;
        blk_t           block;
-       char            *buf = 0;
+       char            *buf = NULL;
 
        if (!block_buf) {
                retval = ext2fs_get_mem(fs->blocksize, &buf);
index b22fe3dbf66583b99006d37bb4d889ade2454651..b2d0279d89434d500ed969d435acb79219d48ce2 100644 (file)
@@ -136,7 +136,7 @@ errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode,
        struct ext2_inode inode_buf;
        blk_t addr_per_block;
        blk_t   b;
-       char    *buf = 0;
+       char    *buf = NULL;
        errcode_t       retval = 0;
        int             blocks_alloc = 0, inode_dirty = 0;
 
index 008d5f36ebee48cb68a4799df329fd40867a1f54..7ba7f22e215c615c06a0cb69ff7f64340ea514d4 100644 (file)
@@ -206,8 +206,8 @@ errcode_t ext2fs_flush(ext2_filsys fs)
        blk_t           group_block;
        errcode_t       retval;
        unsigned long   fs_state;
-       struct ext2_super_block *super_shadow = 0;
-       struct ext2_group_desc *group_shadow = 0;
+       struct ext2_super_block *super_shadow = NULL;
+       struct ext2_group_desc *group_shadow = NULL;
        char    *group_ptr;
        int     old_desc_blocks;
 #if BB_BIG_ENDIAN
index 5d3f6a1bcf9ed69fe5aba1c5e9d1296ff79235f3..f651338e3b549390f545a4c344d501e7fc1b84cf 100644 (file)
@@ -80,7 +80,7 @@ errcode_t ext2fs_write_dir_block2(ext2_filsys fs, blk_t block,
        int             do_swap = 0;
        errcode_t       retval;
        char            *p, *end;
-       char            *buf = 0;
+       char            *buf = NULL;
        struct ext2_dir_entry *dirent;
 
        if ((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
index 7ee41f234d0407b23a89a747e2ae02b343f78bce..a2ba12d45c2e452fec7ae6df8e2adca5122c7bac 100644 (file)
@@ -68,7 +68,7 @@ errcode_t ext2fs_adjust_ea_refcount(ext2_filsys fs, blk_t blk,
 {
        errcode_t       retval;
        struct ext2_ext_attr_header *header;
-       char    *buf = 0;
+       char    *buf = NULL;
 
        if ((blk >= fs->super->s_blocks_count) ||
            (blk < fs->super->s_first_data_block))
index 5e2cce940e3248bbf8c53b706018010a4203e3bd..e9e83fd7ad88c769ba761311cd88f7014d359dfd 100644 (file)
@@ -115,9 +115,9 @@ success:
  */
 char *ext2fs_find_block_device(dev_t device)
 {
-       struct dir_list *list = 0, *new_list = 0;
+       struct dir_list *list = NULL, *new_list = NULL;
        struct dir_list *current;
-       char    *ret_path = 0;
+       char    *ret_path = NULL;
 
        /*
         * Add the starting directories to search...
index e82321efac1bc71177d78072df298be546211b76..0f9cfcfafb5a32d441d26e07212c30ebda65ed3b 100644 (file)
@@ -333,7 +333,7 @@ errout:
  */
 errcode_t ext2fs_image_bitmap_read(ext2_filsys fs, int fd, int flags)
 {
-       char            *ptr, *buf = 0;
+       char            *ptr, *buf = NULL;
        int             size;
        ssize_t         actual;
        errcode_t       retval;
index b63c5d7a681d87303958f21fdae3fc90865ef81e..93f47b06f6c53bda7e4c7ace5e1dd8f42a89cc3d 100644 (file)
@@ -39,7 +39,7 @@ errcode_t ext2fs_mkdir(ext2_filsys fs, ext2_ino_t parent, ext2_ino_t inum,
        ext2_ino_t              ino = inum;
        ext2_ino_t              scratch_ino;
        blk_t                   blk;
-       char                    *block = 0;
+       char                    *block = NULL;
 
        EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
 
index af47aee18b8c896d769354f8d04a554c6c1ba576..db1c8bff369852804d7b71bbb242a79cd6625db8 100644 (file)
@@ -95,7 +95,7 @@ static errcode_t write_journal_file(ext2_filsys fs, char *filename,
                                    blk_t size, int flags)
 {
        errcode_t       retval;
-       char            *buf = 0;
+       char            *buf = NULL;
        int             fd, ret_size;
        blk_t           i;
 
index 4d4e3788c0ff7619c2438bb83cdba08fb1ec6aa4..14d48fb721ece13bad985ed4bd6e92f87806f5d7 100644 (file)
@@ -30,7 +30,7 @@ static errcode_t follow_link(ext2_filsys fs, ext2_ino_t root, ext2_ino_t dir,
                             char *buf, ext2_ino_t *res_inode)
 {
        char *pathname;
-       char *buffer = 0;
+       char *buffer = NULL;
        errcode_t retval;
        struct ext2_inode ei;
 
index a5782db95a7573b560d77d7e8046e57014012912..0ae0a823456af2b36b79823f64587fcc246889b5 100644 (file)
@@ -149,7 +149,7 @@ errcode_t ext2fs_write_block_bitmap (ext2_filsys fs)
 static errcode_t read_bitmaps(ext2_filsys fs, int do_inode, int do_block)
 {
        dgrp_t i;
-       char *block_bitmap = 0, *inode_bitmap = 0;
+       char *block_bitmap = NULL, *inode_bitmap = NULL;
        char *buf;
        errcode_t retval;
        int block_nbytes = (int) EXT2_BLOCKS_PER_GROUP(fs->super) / 8;
index c0964f79d15c793a6f87f64773ea034640d9fa83..dc029b65ab03f9da22c63c369ba1e31d9389872b 100644 (file)
@@ -1166,7 +1166,7 @@ static void signal_cancel(int sig FSCK_ATTR((unused)))
 static void PRS(int argc, char **argv)
 {
        int     i, j;
-       char    *arg, *dev, *tmp = 0;
+       char    *arg, *dev, *tmp = NULL;
        char    options[128];
        int     opt = 0;
        int     opts_for_fsck = 0;
index 32f0329c37203829d43071306de57c8d088e2cb8..52036455052c0fae315a60989796a1abda0772b4 100644 (file)
@@ -799,8 +799,8 @@ static int PRS(int argc, char **argv)
        int             show_version_only = 0;
        ext2_ino_t      num_inodes = 0;
        errcode_t       retval;
-       char *          extended_opts = 0;
-       const char *    fs_type = 0;
+       char *          extended_opts = NULL;
+       const char *    fs_type = NULL;
        blk_t           dev_size;
        long            sysval;
 
index 03904bbf8eea432e7aab308703a0ae5380e42ce3..8ffe67ccabcddfc36479fdedcf3693e387fac8bf 100644 (file)
@@ -2482,7 +2482,7 @@ static void hashcd(void);
 static int
 docd(const char *dest, int flags)
 {
-       const char *dir = 0;
+       const char *dir = NULL;
        int err;
 
        TRACE(("docd(\"%s\", %d) called\n", dest, flags));