From: Matthew Fernandez Date: Sun, 11 Dec 2022 19:51:31 +0000 (-0800) Subject: common parse_style: remove static backing buffer for 'ps_xb' X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=06e016c34205a48a4959b3155784259dd22fcd48;p=graphviz common parse_style: remove static backing buffer for 'ps_xb' There seems little value retaining this when it adds complication and was a contributing factor in the bug just fixed. This potentially slightly degrades performance (initial style use results in a heap allocation), but is unlikely to be measurable and should be regained back if we implement Small String Optimization on `agxbuf`. --- diff --git a/lib/common/emit.c b/lib/common/emit.c index ee04cbda3..b6b8265c4 100644 --- a/lib/common/emit.c +++ b/lib/common/emit.c @@ -3795,7 +3795,6 @@ static token_t style_token(char **s) { } #define FUNLIMIT 64 -static char outbuf[SMALLBUF]; static agxbuf ps_xb; /* parse_style: @@ -3810,16 +3809,10 @@ char **parse_style(char *s) { static char *parse[FUNLIMIT]; size_t parse_offsets[sizeof(parse) / sizeof(parse[0])]; - static bool is_first = true; size_t fun = 0; bool in_parens = false; char *p; - if (is_first) { - agxbinit(&ps_xb, SMALLBUF, outbuf); - is_first = false; - } - p = s; while (true) { token_t c = style_token(&p);