libds

a collection of simple data structures
Log | Files | Refs | LICENSE

commit 449ca59fe7a945f625cdccb3a7e0dfa278a9af5b
parent 333ddcee27671bb21b52565e81d0a8fabc15d6eb
Author: sin <sin@2f30.org>
Date:   Tue,  6 May 2014 13:17:19 +0100

No need to use calloc()

Diffstat:
Mstack.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/stack.c b/stack.c @@ -15,9 +15,10 @@ stack_init(void) { struct stack *s; - s = calloc(1, sizeof(*s)); + s = malloc(sizeof(*s)); if (!s) return NULL; + s->top = NULL; return s; } @@ -40,7 +41,7 @@ stack_push(struct stack *s, void *data) { struct stacknode *n; - n = calloc(1, sizeof(*n)); + n = malloc(sizeof(*n)); if (!n) return NULL; n->data = data;