]> granicus.if.org Git - graphviz/commitdiff
take a const pointer in agstrdup
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 4 Jul 2021 03:45:02 +0000 (20:45 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 18 Jul 2021 00:31:29 +0000 (17:31 -0700)
This function does not modify its string argument, so it is more accurate to
qualify it as const. Related to #634.

CHANGELOG.md
lib/cgraph/cgraph.h
lib/cgraph/refstr.c

index 8a1d4124cba06ffd6e0aa97b03bf250541d22295..9c2171c1644eab926a90145529cb5c0d0153bdbe 100644 (file)
@@ -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
 
index 9684714231c3bcf596ce64a47b174d0eb00138e9..e2ea7f4ea56cb866f547d683ae5be548c041a535 100644 (file)
@@ -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 *);
index c80eebb9e5d5ceaf1d44fe8db0edfc446ce7d42c..0c73fb120b2518e0b45762d36cd70c5112af5756 100644 (file)
@@ -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;