From: Matthew Fernandez Date: Sun, 4 Jul 2021 03:37:10 +0000 (-0700) Subject: take a const pointer in refsymbind X-Git-Tag: 2.49.0~58^2~12 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0b9113e3e4e3c00e36909d7fbbdf0694f8aa502e;p=graphviz take a const pointer in refsymbind This is preparation for accepting const pointers in the agstrdup functions. Related to #634. --- diff --git a/lib/cgraph/refstr.c b/lib/cgraph/refstr.c index f3dbfacb0..c80eebb9e 100644 --- a/lib/cgraph/refstr.c +++ b/lib/cgraph/refstr.c @@ -62,10 +62,19 @@ int agstrclose(Agraph_t * g) return agdtclose(g, refdict(g)); } -static refstr_t *refsymbind(Dict_t * strdict, char *s) +static refstr_t *refsymbind(Dict_t * strdict, const char *s) { refstr_t key, *r; - key.s = s; +// Suppress Clang/GCC -Wcast-qual warning. Casting away const here is acceptable +// as dtsearch does not modify its input key. +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wcast-qual" +#endif + key.s = (char*)s; +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif r = dtsearch(strdict, &key); return r; }