diff options
author | Yaniv Kaul <ykaul@redhat.com> | 2018-08-21 23:36:28 +0300 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-09-07 03:41:32 +0000 |
commit | f6a7f6e8124327509559170faa9a4dce6fad9731 (patch) | |
tree | f11d79293b0c77ea38a4b5cbd6ea411b9eb96e50 /xlators/cluster | |
parent | 50e8b0c335ba4f18987a32e8268ee31498323beb (diff) |
xlators/cluster/dht/src/dht-common.c :move to GF_MALLOC() instead of GF_CALLOC() when
It doesn't make sense to calloc (allocate and clear) memory
when the code right away fills that memory with data.
It may be optimized by the compiler, or have a microscopic
performance improvement.
Please review carefully, especially for string allocation, with the
terminating NULL string (added another byte to ensure it's there).
Only compile-tested!
Change-Id: Ia5e4f50dfb0c29809c2019fcfd8079507813249e
updates: bz#1193929
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 69555a22e5e..5f64d5c254d 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -11477,12 +11477,12 @@ dht_log_new_layout_for_dir_selfheal (xlator_t *this, loc_t *loc, len++; - output_string = GF_CALLOC (len, sizeof (char), gf_common_mt_char); + output_string = GF_MALLOC (len + 1, gf_common_mt_char); if (!output_string) return; - ret = snprintf (output_string, len, "Setting layout of %s with ", + ret = snprintf (output_string, len + 1, "Setting layout of %s with ", loc->path); if (ret < 0) |