From ed4b76ba9c545f577287c0e70ae3cc853a0d5f3f Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Thu, 2 Aug 2012 13:14:25 +0530 Subject: core: reduce the usage of global variables * move all the 'logging' related global variables into ctx * make gf_fop_list a 'const' global array, hence no init(), no edits. * make sure ctx is allocated without any dependancy on memory-accounting infrastructure, so it can be the first one to get allocated * globals_init() should happen with ctx as argument not yet fixed below in this patchset: * anything with 'THIS' related globals * anything related to compat_errno related globals as its one time init'd and not changed later on. * statedump related globals Change-Id: Iab8fc30d4bfdbded6741d66ff1ed670fdc7b7ad2 Signed-off-by: Amar Tumballi BUG: 764890 Reviewed-on: http://review.gluster.com/3767 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- libglusterfs/src/ctx.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'libglusterfs/src/ctx.c') diff --git a/libglusterfs/src/ctx.c b/libglusterfs/src/ctx.c index 22591317d..01489fbe0 100644 --- a/libglusterfs/src/ctx.c +++ b/libglusterfs/src/ctx.c @@ -16,8 +16,6 @@ #include #include "glusterfs.h" -#include "mem-pool.h" - glusterfs_ctx_t * glusterfs_ctx_new () @@ -27,7 +25,7 @@ glusterfs_ctx_new () /* no GF_CALLOC here, gf_acct_mem_set_enable is not yet decided at this point */ - ctx = CALLOC (1, sizeof (*ctx)); + ctx = calloc (1, sizeof (*ctx)); if (!ctx) { ret = -1; goto out; @@ -38,7 +36,7 @@ glusterfs_ctx_new () ret = pthread_mutex_init (&ctx->lock, NULL); if (ret) { - FREE (ctx); + free (ctx); ctx = NULL; } out: -- cgit