From cac2dba48bf8029b2b0421850fcc4598e33569f6 Mon Sep 17 00:00:00 2001 From: Yaniv Kaul Date: Sun, 21 Oct 2018 03:55:04 +0300 Subject: libglusterfs multiple files: remove dead initilization Per newer GCC releases and clang-scan, some trivial dead initialization (values that were set but were never read) were removed. Compile-tested only! updates: bz#1193929 Signed-off-by: Yaniv Kaul Change-Id: Ia9959b2ff87d2e9cb46864e68ffe7dccb984db34 --- libglusterfs/src/common-utils.c | 4 --- libglusterfs/src/ctx.c | 5 +--- libglusterfs/src/fd.c | 4 +++ libglusterfs/src/gfdb/gfdb_data_store.c | 1 - libglusterfs/src/gfdb/gfdb_data_store_helper.c | 1 - libglusterfs/src/inode.c | 2 ++ libglusterfs/src/stack.c | 2 ++ libglusterfs/src/statedump.c | 6 ++-- libglusterfs/src/syncop.c | 40 +------------------------- libglusterfs/src/syncop.h | 3 -- 10 files changed, 13 insertions(+), 55 deletions(-) (limited to 'libglusterfs') diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index bd2cf35a52a..5d66e8d4207 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -750,7 +750,6 @@ xldump_subvolumes(xlator_t *this, void *d) int len = 0; char *subvstr = NULL; - subv = this->children; if (!this->children) return; @@ -2116,7 +2115,6 @@ gf_is_ip_in_net(const char *network, const char *ip_str) else if (strchr(network, '.')) family = AF_INET; else { - family = -1; goto out; } @@ -2433,7 +2431,6 @@ valid_ipv4_address(char *address, int length, gf_boolean_t wildcard_acc) goto out; } - prev = tmp; prev = strtok_r(tmp, ".", &ptr); while (prev != NULL) { @@ -4323,7 +4320,6 @@ gf_backtrace_fillframes(char *buf) fp = fdopen(fd, "r"); if (!fp) { sys_close(fd); - ret = -1; goto out; } diff --git a/libglusterfs/src/ctx.c b/libglusterfs/src/ctx.c index 1e4c341df05..170a5752452 100644 --- a/libglusterfs/src/ctx.c +++ b/libglusterfs/src/ctx.c @@ -17,14 +17,12 @@ glusterfs_ctx_t * glusterfs_ctx_new() { - int ret = 0; glusterfs_ctx_t *ctx = NULL; /* no GF_CALLOC here, gf_acct_mem_set_enable is not yet decided at this point */ ctx = calloc(1, sizeof(*ctx)); if (!ctx) { - ret = -1; goto out; } @@ -44,8 +42,7 @@ glusterfs_ctx_new() #endif /* lock is never destroyed! */ - ret = LOCK_INIT(&ctx->lock); - if (ret) { + if (LOCK_INIT(&ctx->lock)) { free(ctx); ctx = NULL; goto out; diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c index 6c521317110..25edcbdd387 100644 --- a/libglusterfs/src/fd.c +++ b/libglusterfs/src/fd.c @@ -1131,6 +1131,8 @@ fdentry_dump_to_dict(fdentry_t *fdentry, char *prefix, dict_t *dict, snprintf(key, sizeof(key), "%s.flags", prefix); ret = dict_set_int32(dict, key, fdentry->fd->flags); + if (ret) + return; (*openfds)++; } @@ -1180,6 +1182,8 @@ fdtable_dump_to_dict(fdtable_t *fdtable, char *prefix, dict_t *dict) snprintf(key, sizeof(key), "%s.fdtable.openfds", prefix); ret = dict_set_int32(dict, key, openfds); + if (ret) + goto out; out: pthread_rwlock_unlock(&fdtable->lock); diff --git a/libglusterfs/src/gfdb/gfdb_data_store.c b/libglusterfs/src/gfdb/gfdb_data_store.c index 426596c571e..ab56a51d462 100644 --- a/libglusterfs/src/gfdb/gfdb_data_store.c +++ b/libglusterfs/src/gfdb/gfdb_data_store.c @@ -267,7 +267,6 @@ init_db(dict_t *args, gfdb_db_type_t gfdb_db_type) goto init_db_failed; } _conn_node->gfdb_connection.gfdb_db_type = gfdb_db_type; - ret = 0; return _conn_node; diff --git a/libglusterfs/src/gfdb/gfdb_data_store_helper.c b/libglusterfs/src/gfdb/gfdb_data_store_helper.c index fb01a6c699b..b1f79bc8dad 100644 --- a/libglusterfs/src/gfdb/gfdb_data_store_helper.c +++ b/libglusterfs/src/gfdb/gfdb_data_store_helper.c @@ -313,7 +313,6 @@ gfdb_query_record_serialize(gfdb_query_record_t *query_record, char **in_buffer) /* Copying the Footer of the record */ memcpy(buffer, &footer, sizeof(int32_t)); - buffer += sizeof(int32_t); count += sizeof(int32_t); out: diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c index 8bfd5c70db8..b8e389ac140 100644 --- a/libglusterfs/src/inode.c +++ b/libglusterfs/src/inode.c @@ -2392,6 +2392,8 @@ inode_dump_to_dict(inode_t *inode, char *prefix, dict_t *dict) snprintf(key, sizeof(key), "%s.ia_type", prefix); ret = dict_set_int32(dict, key, inode->ia_type); + if (ret) + goto out; out: UNLOCK(&inode->lock); diff --git a/libglusterfs/src/stack.c b/libglusterfs/src/stack.c index 4b5d13c3fc8..c06e2dc378d 100644 --- a/libglusterfs/src/stack.c +++ b/libglusterfs/src/stack.c @@ -327,6 +327,8 @@ gf_proc_dump_call_frame_to_dict(call_frame_t *call_frame, char *prefix, if (tmp_frame.unwind_to) { snprintf(key, sizeof(key), "%s.unwind_to", prefix); ret = dict_set_dynstr(dict, key, gf_strdup(tmp_frame.unwind_to)); + if (ret) + return; } return; diff --git a/libglusterfs/src/statedump.c b/libglusterfs/src/statedump.c index 0f4a7102697..ed5cad5349b 100644 --- a/libglusterfs/src/statedump.c +++ b/libglusterfs/src/statedump.c @@ -745,7 +745,7 @@ gf_proc_dump_options_init() (void)gf_proc_dump_disable_all_options(); // swallow the errors if setting statedump file path is failed. - ret = gf_proc_dump_set_path(dump_option_file); + (void)gf_proc_dump_set_path(dump_option_file); ret = fscanf(fp, "%s", buf); @@ -864,7 +864,7 @@ gf_proc_dump_info(int signum, glusterfs_ctx_t *ctx) timestr); // swallow the errors of write for start and end marker - ret = sys_write(gf_dump_fd, sign_string, len); + (void)sys_write(gf_dump_fd, sign_string, len); memset(timestr, 0, sizeof(timestr)); @@ -914,7 +914,7 @@ gf_proc_dump_info(int signum, glusterfs_ctx_t *ctx) len = snprintf(sign_string, sizeof(sign_string), "\nDUMP-END-TIME: %s", timestr); - ret = sys_write(gf_dump_fd, sign_string, len); + (void)sys_write(gf_dump_fd, sign_string, len); if (gf_dump_fd != -1) gf_proc_dump_close(); diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c index 18ce6cf73af..edf978d797d 100644 --- a/libglusterfs/src/syncop.c +++ b/libglusterfs/src/syncop.c @@ -3397,42 +3397,4 @@ syncop_namelink_cbk(call_frame_t *frame, void *cookie, xlator_t *this, __wake(args); return 0; -} - -int -syncop_icreate(xlator_t *subvol, loc_t *loc, mode_t mode, dict_t *xdata) -{ - struct syncargs args = { - 0, - }; - - SYNCOP(subvol, (&args), syncop_icreate_cbk, subvol->fops->icreate, loc, - mode, xdata); - - if (xdata) - xdata = args.xdata; - else if (args.xdata) - dict_unref(args.xdata); - - errno = args.op_errno; - return args.op_ret; -} - -int -syncop_namelink(xlator_t *subvol, loc_t *loc, dict_t *xdata) -{ - struct syncargs args = { - 0, - }; - - SYNCOP(subvol, (&args), syncop_namelink_cbk, subvol->fops->namelink, loc, - xdata); - - if (xdata) - xdata = args.xdata; - else if (args.xdata) - dict_unref(args.xdata); - - errno = args.op_errno; - return args.op_ret; -} +} \ No newline at end of file diff --git a/libglusterfs/src/syncop.h b/libglusterfs/src/syncop.h index cea52429f6f..88279d15490 100644 --- a/libglusterfs/src/syncop.h +++ b/libglusterfs/src/syncop.h @@ -629,9 +629,6 @@ syncop_setactivelk_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int syncop_icreate(xlator_t *subvol, loc_t *loc, mode_t mode, dict_t *xdata_out); -int -syncop_namelink(xlator_t *subvol, loc_t *loc, dict_t *xdata_out); - int syncop_entrylk(xlator_t *subvol, const char *volume, loc_t *loc, const char *basename, entrylk_cmd cmd, entrylk_type type, -- cgit