summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/stack.h
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs/src/stack.h')
-rw-r--r--libglusterfs/src/stack.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/libglusterfs/src/stack.h b/libglusterfs/src/stack.h
index 20fbdfabff5..eb5848e92aa 100644
--- a/libglusterfs/src/stack.h
+++ b/libglusterfs/src/stack.h
@@ -357,21 +357,26 @@ STACK_RESET (call_stack_t *stack)
} while (0)
+static void
+call_stack_set_groups (call_stack_t *stack, int ngrps, gid_t *groupbuf)
+{
+ stack->groups = groupbuf;
+ stack->ngrps = ngrps;
+}
+
static inline int
call_stack_alloc_groups (call_stack_t *stack, int ngrps)
{
if (ngrps <= SMALL_GROUP_COUNT) {
- stack->groups = stack->groups_small;
+ call_stack_set_groups (stack, ngrps, stack->groups_small);
} else {
- stack->groups_large = GF_CALLOC (sizeof (gid_t), ngrps,
+ stack->groups_large = GF_CALLOC (ngrps, sizeof (gid_t),
gf_common_mt_groups_t);
if (!stack->groups_large)
return -1;
- stack->groups = stack->groups_large;
+ call_stack_set_groups (stack, ngrps, stack->groups_large);
}
- stack->ngrps = ngrps;
-
return 0;
}