From 4e01c34b8bf06268a515b7ffe83e905b0a02ef38 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Fri, 6 Nov 2015 16:53:55 +0100 Subject: btrfs-progs: simplify empty stirngs check We can do a strlen(str) == 0 in a simpler way. Signed-off-by: David Sterba --- cmds-receive.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'cmds-receive.c') diff --git a/cmds-receive.c b/cmds-receive.c index 1d7d897f..3a84a3bf 100644 --- a/cmds-receive.c +++ b/cmds-receive.c @@ -169,7 +169,7 @@ static int process_subvol(const char *path, const u8 *uuid, u64 ctransid, BUG_ON(r->cur_subvol.path); BUG_ON(r->cur_subvol_path[0]); - if (strlen(r->dest_dir_path) == 0) { + if (*r->dest_dir_path == 0) { strncpy_null(r->cur_subvol_path, path); } else { ret = path_cat_out(r->cur_subvol_path, r->dest_dir_path, path); @@ -229,7 +229,7 @@ static int process_snapshot(const char *path, const u8 *uuid, u64 ctransid, BUG_ON(r->cur_subvol.path); BUG_ON(r->cur_subvol_path[0]); - if (strlen(r->dest_dir_path) == 0) { + if (*r->dest_dir_path == 0) { strncpy_null(r->cur_subvol_path, path); } else { ret = path_cat_out(r->cur_subvol_path, r->dest_dir_path, path); @@ -326,7 +326,7 @@ static int process_snapshot(const char *path, const u8 *uuid, u64 ctransid, } }*/ - if (strlen(parent_subvol->path) == 0) + if (*parent_subvol->path == 0) args_v2.fd = dup(r->mnt_fd); else args_v2.fd = openat(r->mnt_fd, parent_subvol->path, @@ -1135,7 +1135,7 @@ static int do_receive(struct btrfs_receive *r, const char *tomnt, * Ok we're inside of a subvol off of the root subvol, we need to * actually set full_root_path. */ - if (strlen(root_subvol_path)) + if (*root_subvol_path) r->full_root_path = root_subvol_path; if (r->dest_dir_chroot) { -- cgit v1.2.3