diff options
author | Yaniv Kaul <ykaul@redhat.com> | 2018-08-08 21:41:10 +0300 |
---|---|---|
committer | Niels de Vos <ndevos@redhat.com> | 2018-08-22 13:30:47 +0000 |
commit | 54e5fae2bbea0086c7dd7951bb8776c3672fedf4 (patch) | |
tree | 16e6ef2a250a07da4f5f922635be38c6874c0a60 /libglusterfs | |
parent | ec8174353af31def3d715b1a5a38207d92b3c6fa (diff) |
libglusterfs/src/client_t.c: Move to GF_MALLOC() instead of GF_CALLOC() when possible
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.
In some cases, also changed allocation size to be sizeof some
struct or type instead of a pointer - easier to read.
In some cases, removed redundant strlen() calls by saving the result
into a variable.
1. Only done for the straightforward cases. There's room for improvement.
2. Please review carefully, especially for string allocation, with the
terminating NULL string.
Only compile-tested!
updates: bz#1193929
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
Change-Id: I58d2604ef684f94ea782fdbb1b1462fc7be53a9e
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/client_t.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libglusterfs/src/client_t.c b/libglusterfs/src/client_t.c index 046f72e021d..eb9e7a78b22 100644 --- a/libglusterfs/src/client_t.c +++ b/libglusterfs/src/client_t.c @@ -236,7 +236,7 @@ gf_client_get (xlator_t *this, struct rpcsvc_auth_data *cred, char *client_uid, client->auth.flavour = cred->flavour; if (cred->flavour != AUTH_NONE) { client->auth.data = - GF_CALLOC (1, cred->datalen, + GF_MALLOC (cred->datalen, gf_common_mt_client_t); if (client->auth.data == NULL) { GF_FREE (client->scratch_ctx.ctx); |