diff options
author | Yaniv Kaul <ykaul@redhat.com> | 2018-08-02 16:02:33 +0300 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-08-14 05:15:04 +0000 |
commit | b2b6ab8eff317f6a507ab23897ea6cd5c718d99a (patch) | |
tree | 45fb1392f535f0236f057d9d9c932feda4f9ab40 /libglusterfs/src/statedump.c | |
parent | 32c8f70f49c0e287c53998e37867f00fa775377b (diff) |
All: remove memset() before sprintf()
It's not needed.
There's a good chance the compiler is smart enough to remove it
anyway, but it can't hurt - I hope.
Compile-tested only!
Change-Id: Id7c054e146ba630227affa591007803f3046416b
updates: bz#1193929
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
Diffstat (limited to 'libglusterfs/src/statedump.c')
-rw-r--r-- | libglusterfs/src/statedump.c | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/libglusterfs/src/statedump.c b/libglusterfs/src/statedump.c index 21a916ea6b8..d769d7a9ef2 100644 --- a/libglusterfs/src/statedump.c +++ b/libglusterfs/src/statedump.c @@ -126,7 +126,6 @@ gf_proc_dump_add_section_fd (char *key, va_list ap) GF_ASSERT(key); - memset (buf, 0, sizeof(buf)); snprintf (buf, GF_DUMP_MAX_BUF_LEN, "\n["); vsnprintf (buf + strlen(buf), GF_DUMP_MAX_BUF_LEN - strlen (buf), key, ap); @@ -175,10 +174,7 @@ gf_proc_dump_write_fd (char *key, char *value, va_list ap) GF_ASSERT (key); - offset = strlen (key); - - memset (buf, 0, GF_DUMP_MAX_BUF_LEN); - snprintf (buf, GF_DUMP_MAX_BUF_LEN, "%s", key); + offset = snprintf (buf, GF_DUMP_MAX_BUF_LEN, "%s", key); snprintf (buf + offset, GF_DUMP_MAX_BUF_LEN - offset, "="); offset += 1; vsnprintf (buf + offset, GF_DUMP_MAX_BUF_LEN - offset, value, ap); @@ -429,49 +425,41 @@ gf_proc_dump_mempool_info_to_dict (glusterfs_ctx_t *ctx, dict_t *dict) return; list_for_each_entry (pool, &ctx->mempool_list, global_list) { - memset (key, 0, sizeof (key)); snprintf (key, sizeof (key), "pool%d.name", count); ret = dict_set_str (dict, key, pool->name); if (ret) return; - memset (key, 0, sizeof (key)); snprintf (key, sizeof (key), "pool%d.hotcount", count); ret = dict_set_int32 (dict, key, pool->hot_count); if (ret) return; - memset (key, 0, sizeof (key)); snprintf (key, sizeof (key), "pool%d.coldcount", count); ret = dict_set_int32 (dict, key, pool->cold_count); if (ret) return; - memset (key, 0, sizeof (key)); snprintf (key, sizeof (key), "pool%d.paddedsizeof", count); ret = dict_set_uint64 (dict, key, pool->padded_sizeof_type); if (ret) return; - memset (key, 0, sizeof (key)); snprintf (key, sizeof (key), "pool%d.alloccount", count); ret = dict_set_uint64 (dict, key, pool->alloc_count); if (ret) return; - memset (key, 0, sizeof (key)); snprintf (key, sizeof (key), "pool%d.max_alloc", count); ret = dict_set_int32 (dict, key, pool->max_alloc); if (ret) return; - memset (key, 0, sizeof (key)); snprintf (key, sizeof (key), "pool%d.max-stdalloc", count); ret = dict_set_int32 (dict, key, pool->max_stdalloc); if (ret) return; - memset (key, 0, sizeof (key)); snprintf (key, sizeof (key), "pool%d.pool-misses", count); ret = dict_set_uint64 (dict, key, pool->pool_misses); if (ret) @@ -893,9 +881,7 @@ gf_proc_dump_info (int signum, glusterfs_ctx_t *ctx) //swallow the errors of write for start and end marker ret = sys_write (gf_dump_fd, sign_string, strlen (sign_string)); - memset (sign_string, 0, sizeof (sign_string)); memset (timestr, 0, sizeof (timestr)); - memset (&tv, 0, sizeof (tv)); if (GF_PROC_DUMP_IS_OPTION_ENABLED (mem)) { gf_proc_dump_mem_info (); |