From: Matthew Fernandez Date: Sun, 4 Jul 2021 03:45:02 +0000 (-0700) Subject: take a const pointer in agstrdup X-Git-Tag: 2.49.0~58^2~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6c22e103010d17790b80701691bb797d53d97e6d;p=graphviz take a const pointer in agstrdup This function does not modify its string argument, so it is more accurate to qualify it as const. Related to #634. --- diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a1d4124c..9c2171c16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - the CMake build system now enables `-Wextra` when building C++ +- some Cgraph functions that take `char*` arguments that they do not modify have + been updated to take `const char*` arguments #634 ## [2.48.0] - 2021-07-17 diff --git a/lib/cgraph/cgraph.h b/lib/cgraph/cgraph.h index 968471423..e2ea7f4ea 100644 --- a/lib/cgraph/cgraph.h +++ b/lib/cgraph/cgraph.h @@ -302,7 +302,7 @@ CGRAPH_API int agdeledge(Agraph_t * g, Agedge_t * arg_e); CGRAPH_API int agobjkind(void *); /* strings */ -CGRAPH_API char *agstrdup(Agraph_t *, char *); +CGRAPH_API char *agstrdup(Agraph_t *, const char *); CGRAPH_API char *agstrdup_html(Agraph_t *, char *); CGRAPH_API int aghtmlstr(char *); CGRAPH_API char *agstrbind(Agraph_t * g, char *); diff --git a/lib/cgraph/refstr.c b/lib/cgraph/refstr.c index c80eebb9e..0c73fb120 100644 --- a/lib/cgraph/refstr.c +++ b/lib/cgraph/refstr.c @@ -94,7 +94,7 @@ char *agstrbind(Agraph_t * g, char *s) return refstrbind(refdict(g), s); } -char *agstrdup(Agraph_t * g, char *s) +char *agstrdup(Agraph_t * g, const char *s) { refstr_t *r; Dict_t *strdict;