Fix graph datas calloc and SLIST_INSERT_TAIL

This commit is contained in:
Martin Duquesnoy 2012-02-12 02:12:52 +01:00
parent 9d9c097dd3
commit 7c31faa096
2 changed files with 4 additions and 2 deletions

View File

@ -114,7 +114,7 @@ status_graph_process(struct status_ctx *ctx, struct status_seq *sq, char *name)
gc = xcalloc(1, sizeof(struct status_gcache));
gc->name = xstrdup(name);
gc->ndata = 1;
gc->datas = xcalloc(sq->geo.w + sq->geo.w, sizeof(int));
gc->datas = xcalloc(sq->geo.w << 2, sizeof(int));
gc->datas[0] = sq->data[1];
SLIST_INSERT_HEAD(&ctx->gcache, gc, next);
@ -487,6 +487,8 @@ status_flush_list(struct status_ctx *ctx)
free(sq->str);
free(sq);
}
SLIST_INIT(&ctx->statushead);
}
void

View File

@ -23,7 +23,7 @@
/* Insert at the end with SLIST */
#define SLIST_INSERT_TAIL(head, elem, field, prev) \
if(SLIST_EMPTY(head)) \
if(!prev) \
SLIST_INSERT_HEAD(head, elem, field); \
else \
SLIST_INSERT_AFTER(prev, elem, field);