From: Denys Vlasenko Date: Fri, 5 Mar 2010 13:10:54 +0000 (+0100) Subject: *: use NULL for null pointers X-Git-Tag: 1_17_0~435 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4b1100edd8180efa2e81860ef2fadeebcb21f5fa;p=oweals%2Fbusybox.git *: use NULL for null pointers Signed-off-by: Denys Vlasenko --- diff --git a/e2fsprogs/old_e2fsprogs/blkid/devname.c b/e2fsprogs/old_e2fsprogs/blkid/devname.c index 348e5d42e..fad92cb31 100644 --- a/e2fsprogs/old_e2fsprogs/blkid/devname.c +++ b/e2fsprogs/old_e2fsprogs/blkid/devname.c @@ -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; diff --git a/e2fsprogs/old_e2fsprogs/blkid/probe.c b/e2fsprogs/old_e2fsprogs/blkid/probe.c index 1f7188e6d..77bfc737d 100644 --- a/e2fsprogs/old_e2fsprogs/blkid/probe.c +++ b/e2fsprogs/old_e2fsprogs/blkid/probe.c @@ -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; diff --git a/e2fsprogs/old_e2fsprogs/blkid/resolve.c b/e2fsprogs/old_e2fsprogs/blkid/resolve.c index 0f92158e2..295ca61bf 100644 --- a/e2fsprogs/old_e2fsprogs/blkid/resolve.c +++ b/e2fsprogs/old_e2fsprogs/blkid/resolve.c @@ -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) diff --git a/e2fsprogs/old_e2fsprogs/blkid/tag.c b/e2fsprogs/old_e2fsprogs/blkid/tag.c index c0a93df98..8337b46b6 100644 --- a/e2fsprogs/old_e2fsprogs/blkid/tag.c +++ b/e2fsprogs/old_e2fsprogs/blkid/tag.c @@ -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; diff --git a/e2fsprogs/old_e2fsprogs/e2fsck.c b/e2fsprogs/old_e2fsprogs/e2fsck.c index 7e0996956..7384bc453 100644 --- a/e2fsprogs/old_e2fsprogs/e2fsck.c +++ b/e2fsprogs/old_e2fsprogs/e2fsck.c @@ -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) diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/alloc.c b/e2fsprogs/old_e2fsprogs/ext2fs/alloc.c index 590f23a7e..5021d72c9 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/alloc.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/alloc.c @@ -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); diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/bmap.c b/e2fsprogs/old_e2fsprogs/ext2fs/bmap.c index b22fe3dbf..b2d0279d8 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/bmap.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/bmap.c @@ -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; diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/closefs.c b/e2fsprogs/old_e2fsprogs/ext2fs/closefs.c index 008d5f36e..7ba7f22e2 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/closefs.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/closefs.c @@ -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 diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/dirblock.c b/e2fsprogs/old_e2fsprogs/ext2fs/dirblock.c index 5d3f6a1bc..f651338e3 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/dirblock.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/dirblock.c @@ -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) || diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/ext_attr.c b/e2fsprogs/old_e2fsprogs/ext2fs/ext_attr.c index 7ee41f234..a2ba12d45 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/ext_attr.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/ext_attr.c @@ -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)) diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/finddev.c b/e2fsprogs/old_e2fsprogs/ext2fs/finddev.c index 5e2cce940..e9e83fd7a 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/finddev.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/finddev.c @@ -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... diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/imager.c b/e2fsprogs/old_e2fsprogs/ext2fs/imager.c index e82321efa..0f9cfcfaf 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/imager.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/imager.c @@ -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; diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/mkdir.c b/e2fsprogs/old_e2fsprogs/ext2fs/mkdir.c index b63c5d7a6..93f47b06f 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/mkdir.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/mkdir.c @@ -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); diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/mkjournal.c b/e2fsprogs/old_e2fsprogs/ext2fs/mkjournal.c index af47aee18..db1c8bff3 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/mkjournal.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/mkjournal.c @@ -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; diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/namei.c b/e2fsprogs/old_e2fsprogs/ext2fs/namei.c index 4d4e3788c..14d48fb72 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/namei.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/namei.c @@ -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; diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/rw_bitmaps.c b/e2fsprogs/old_e2fsprogs/ext2fs/rw_bitmaps.c index a5782db95..0ae0a8234 100644 --- a/e2fsprogs/old_e2fsprogs/ext2fs/rw_bitmaps.c +++ b/e2fsprogs/old_e2fsprogs/ext2fs/rw_bitmaps.c @@ -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; diff --git a/e2fsprogs/old_e2fsprogs/fsck.c b/e2fsprogs/old_e2fsprogs/fsck.c index c0964f79d..dc029b65a 100644 --- a/e2fsprogs/old_e2fsprogs/fsck.c +++ b/e2fsprogs/old_e2fsprogs/fsck.c @@ -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; diff --git a/e2fsprogs/old_e2fsprogs/mke2fs.c b/e2fsprogs/old_e2fsprogs/mke2fs.c index 32f0329c3..520364550 100644 --- a/e2fsprogs/old_e2fsprogs/mke2fs.c +++ b/e2fsprogs/old_e2fsprogs/mke2fs.c @@ -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; diff --git a/shell/ash.c b/shell/ash.c index 03904bbf8..8ffe67cca 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -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));