diff options
author | Yaniv Kaul <ykaul@redhat.com> | 2018-08-21 23:30:03 +0300 |
---|---|---|
committer | Niels de Vos <ndevos@redhat.com> | 2018-08-22 08:56:46 +0000 |
commit | ec8174353af31def3d715b1a5a38207d92b3c6fa (patch) | |
tree | f810ec5e39c8220231f818b3742e2b2d5adf6b33 /api | |
parent | 0ebaa9c66347a78c3dce649e833143832114343a (diff) |
api/src/glfs.c: move to GF_MALLOC() instead of GF_CALLOC()
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.
Only compile-tested!
Change-Id: Ieeb86ff5d99176250f57c0a28c215c709b83fc80
updates: bz#1193929
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
Diffstat (limited to 'api')
-rw-r--r-- | api/src/glfs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/api/src/glfs.c b/api/src/glfs.c index a249534ffef..9b8cd4f2d2f 100644 --- a/api/src/glfs.c +++ b/api/src/glfs.c @@ -596,7 +596,7 @@ get_fop_attr_glfd (dict_t **fop_attr, struct glfs_fd *glfd) int ret = 0; gf_boolean_t dict_create = _gf_false; - leaseid = GF_CALLOC (1, LEASE_ID_SIZE, gf_common_mt_char); + leaseid = GF_MALLOC (LEASE_ID_SIZE, gf_common_mt_char); GF_CHECK_ALLOC_AND_LOG("gfapi", leaseid, ret, "lease id alloc failed", out); memcpy (leaseid, glfd->lease_id, LEASE_ID_SIZE); if (*fop_attr == NULL) { |