From: Matthew Fernandez Date: Sat, 13 Aug 2022 15:34:45 +0000 (-0700) Subject: core plugin: use const arrays for some strings X-Git-Tag: 5.0.1~4^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c8be7af6bd21053242f2c92a730bc506641a4d7f;p=graphviz core plugin: use const arrays for some strings This makes very little difference to the compiler, as it can see all uses of these strings. But this makes it clearer to readers that these variables are not modified. Using an array instead of a pointer slightly increases flexibility, allowing a useful application of `sizeof` to these variables should we ever want to do that. --- diff --git a/plugin/core/gvrender_core_svg.c b/plugin/core/gvrender_core_svg.c index 4b2a63401..f86da09eb 100644 --- a/plugin/core/gvrender_core_svg.c +++ b/plugin/core/gvrender_core_svg.c @@ -46,13 +46,13 @@ typedef enum { FORMAT_SVG, FORMAT_SVGZ, } format_type; /* SVG dash array */ -static char *sdasharray = "5,2"; +static const char sdasharray[] = "5,2"; /* SVG dot array */ -static char *sdotarray = "1,5"; +static const char sdotarray[] = "1,5"; -static char *transparent = "transparent"; -static char *none = "none"; -static char *black = "black"; +static const char transparent[] = "transparent"; +static const char none[] = "none"; +static const char black[] = "black"; static void svg_bzptarray(GVJ_t * job, pointf * A, int n) {