From 83d0a1727b9122d3e7e04943aeb2af5f4203d1fc Mon Sep 17 00:00:00 2001 From: Byongho Lee Date: Mon, 4 Jan 2016 10:01:30 +0900 Subject: [PATCH] btrfs-progs: use NULL instead of 0 Fix the code assigning 0 to pointer instead of NULL. Signed-off-by: Byongho Lee Signed-off-by: David Sterba --- cmds-fi-usage.c | 12 ++++++------ props.c | 2 +- qgroup.c | 6 ++++-- utils.c | 4 ++-- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/cmds-fi-usage.c b/cmds-fi-usage.c index 72d80278..852e5651 100644 --- a/cmds-fi-usage.c +++ b/cmds-fi-usage.c @@ -47,7 +47,7 @@ static int add_info_to_list(struct chunk_info **info_ptr, for (j = 0 ; j < num_stripes ; j++) { int i; - struct chunk_info *p = 0; + struct chunk_info *p = NULL; struct btrfs_stripe *stripe; u64 devid; @@ -182,7 +182,7 @@ static int load_chunk_info(int fd, struct chunk_info **info_ptr, int *info_count ret = add_info_to_list(info_ptr, info_count, item); if (ret) { - *info_ptr = 0; + *info_ptr = NULL; return 1; } @@ -228,7 +228,7 @@ static int cmp_btrfs_ioctl_space_info(const void *a, const void *b) */ static struct btrfs_ioctl_space_args *load_space_info(int fd, char *path) { - struct btrfs_ioctl_space_args *sargs = 0, *sargs_orig = 0; + struct btrfs_ioctl_space_args *sargs = NULL, *sargs_orig = NULL; int e, ret, count; sargs_orig = sargs = calloc(1, sizeof(struct btrfs_ioctl_space_args)); @@ -312,7 +312,7 @@ static int print_filesystem_usage_overall(int fd, struct chunk_info *chunkinfo, int chunkcount, struct device_info *devinfo, int devcount, char *path, unsigned unit_mode) { - struct btrfs_ioctl_space_args *sargs = 0; + struct btrfs_ioctl_space_args *sargs = NULL; int i; int ret = 0; int width = 10; /* default 10 for human units */ @@ -510,7 +510,7 @@ static int load_device_info(int fd, struct device_info **device_info_ptr, struct device_info *info; *device_info_count = 0; - *device_info_ptr = 0; + *device_info_ptr = NULL; ret = ioctl(fd, BTRFS_IOC_FS_INFO, &fi_args); if (ret < 0) { @@ -620,7 +620,7 @@ static void _cmd_filesystem_usage_tabular(unsigned unit_mode, { int i; u64 total_unused = 0; - struct string_table *matrix = 0; + struct string_table *matrix = NULL; int ncols, nrows; int col; int unallocated_col; diff --git a/props.c b/props.c index c9e2bd41..5b749324 100644 --- a/props.c +++ b/props.c @@ -194,5 +194,5 @@ const struct prop_handler prop_handlers[] = { prop_object_dev | prop_object_root, prop_label}, {"compression", "Set/get compression for a file or directory", 0, prop_object_inode, prop_compression}, - {0, 0, 0, 0, 0} + {NULL, NULL, 0, 0, NULL} }; diff --git a/qgroup.c b/qgroup.c index 1fbfcb97..f56f51a0 100644 --- a/qgroup.c +++ b/qgroup.c @@ -1117,7 +1117,8 @@ static int __qgroups_search(int fd, struct qgroup_lookup *qgroup_lookup) btrfs_stack_qgroup_info_exclusive_compressed (info); add_qgroup(qgroup_lookup, sh->offset, a1, a2, - a3, a4, a5, 0, 0, 0, 0, 0, 0, 0); + a3, a4, a5, 0, 0, 0, 0, 0, + NULL, NULL); } else if (sh->type == BTRFS_QGROUP_LIMIT_KEY) { limit = (struct btrfs_qgroup_limit_item *) (args.buf + off); @@ -1132,7 +1133,8 @@ static int __qgroups_search(int fd, struct qgroup_lookup *qgroup_lookup) a5 = btrfs_stack_qgroup_limit_rsv_exclusive (limit); add_qgroup(qgroup_lookup, sh->offset, 0, 0, - 0, 0, 0, a1, a2, a3, a4, a5, 0, 0); + 0, 0, 0, a1, a2, a3, a4, a5, + NULL, NULL); } else if (sh->type == BTRFS_QGROUP_RELATION_KEY) { if (sh->offset < sh->objectid) goto skip; diff --git a/utils.c b/utils.c index 32e6e399..03648db6 100644 --- a/utils.c +++ b/utils.c @@ -154,7 +154,7 @@ int test_uuid_unique(char *fs_uuid) blkid_dev dev = NULL; blkid_cache cache = NULL; - if (blkid_get_cache(&cache, 0) < 0) { + if (blkid_get_cache(&cache, NULL) < 0) { printf("ERROR: lblkid cache get failed\n"); return 1; } @@ -2601,7 +2601,7 @@ int btrfs_scan_lblkid(void) if (btrfs_scan_done) return 0; - if (blkid_get_cache(&cache, 0) < 0) { + if (blkid_get_cache(&cache, NULL) < 0) { printf("ERROR: lblkid cache get failed\n"); return 1; }