From: Matthew Fernandez Date: Fri, 2 Sep 2022 01:17:10 +0000 (-0700) Subject: smyrna create_color_theme: use cgraph wrapper for allocations X-Git-Tag: 6.0.1~13^2~16 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2d528e4b897394b22c0337039e5927e6f3968ee6;p=graphviz smyrna create_color_theme: use cgraph wrapper for allocations The lib/cgraph/alloc.h wrappers are similar to the older lib/common/memory.h wrappers except (1) they are header-only and (2) they live in a directory (cgraph) that is at the root of the dependency tree. The long term plan is to replace all use of lib/common/memory.h with lib/cgraph/alloc.h. --- diff --git a/cmd/smyrna/viewport.c b/cmd/smyrna/viewport.c index 96a227dd0..1edacb35e 100644 --- a/cmd/smyrna/viewport.c +++ b/cmd/smyrna/viewport.c @@ -723,19 +723,17 @@ static colordata palette[] = { static colorschemaset *create_color_theme(int themeid) { - colorschemaset *s; - if (themeid < 0 || (int)NUM_SCHEMES <= themeid) { fprintf (stderr, "colorschemaset: illegal themeid %d\n", themeid); return view->colschms; } - s = NEW(colorschemaset); + colorschemaset *s = gv_alloc(sizeof(colorschemaset)); if (view->colschms) clear_color_theme(view->colschms); s->schemacount = palette[themeid].cnt; - s->s = N_NEW(s->schemacount,colorschema); + s->s = gv_calloc(s->schemacount, sizeof(colorschema)); set_color_theme_color(s, palette[themeid].colors); return s;