From b2b6ab8eff317f6a507ab23897ea6cd5c718d99a Mon Sep 17 00:00:00 2001 From: Yaniv Kaul Date: Thu, 2 Aug 2018 16:02:33 +0300 Subject: 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 --- xlators/debug/io-stats/src/io-stats.c | 8 -------- 1 file changed, 8 deletions(-) (limited to 'xlators/debug/io-stats/src') diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index 7eaffa00c78..7a7a9217df0 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -1301,10 +1301,6 @@ io_stats_dump_global_to_logfp (xlator_t *this, struct ios_global_stats *stats, ios_log (this, logfp, "%s", str_read); ios_log (this, logfp, "%s\n", str_write); - memset (str_header, 0, sizeof (str_header)); - memset (str_read, 0, sizeof (str_read)); - memset (str_write, 0, sizeof (str_write)); - snprintf (str_header, sizeof (str_header), "%-12s %c", "Block Size", ':'); snprintf (str_read, sizeof (str_read), "%-12s %c", @@ -1437,7 +1433,6 @@ io_stats_dump_global_to_dict (xlator_t *this, struct ios_global_stats *stats, gf_log (this->name, GF_LOG_ERROR, "failed to set " "interval %d", interval); - memset (key, 0, sizeof (key)); snprintf (key, sizeof (key), "%d-duration", interval); sec = (uint64_t) (now->tv_sec - stats->started_at.tv_sec); ret = dict_set_uint64 (dict, key, sec); @@ -1447,7 +1442,6 @@ io_stats_dump_global_to_dict (xlator_t *this, struct ios_global_stats *stats, goto out; } - memset (key, 0, sizeof (key)); snprintf (key, sizeof (key), "%d-total-read", interval); ret = dict_set_uint64 (dict, key, GF_ATOMIC_GET (stats->data_read)); if (ret) { @@ -1457,7 +1451,6 @@ io_stats_dump_global_to_dict (xlator_t *this, struct ios_global_stats *stats, goto out; } - memset (key, 0, sizeof (key)); snprintf (key, sizeof (key), "%d-total-write", interval); ret = dict_set_uint64 (dict, key, GF_ATOMIC_GET (stats->data_written)); if (ret) { @@ -1469,7 +1462,6 @@ io_stats_dump_global_to_dict (xlator_t *this, struct ios_global_stats *stats, for (i = 0; i < 32; i++) { count = GF_ATOMIC_GET (stats->block_count_read[i]); if (count) { - memset (key, 0, sizeof (key)); snprintf (key, sizeof (key), "%d-read-%d", interval, (1 << i)); ret = dict_set_uint64 (dict, key, count); -- cgit