From ec8174353af31def3d715b1a5a38207d92b3c6fa Mon Sep 17 00:00:00 2001 From: Yaniv Kaul Date: Tue, 21 Aug 2018 23:30:03 +0300 Subject: 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 --- api/src/glfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'api') 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) { -- cgit