]> granicus.if.org Git - graphviz/commitdiff
Add const modifier to string insert functions. This is correct, and
authorerg <devnull@localhost>
Sat, 26 Feb 2011 20:02:10 +0000 (20:02 +0000)
committererg <devnull@localhost>
Sat, 26 Feb 2011 20:02:10 +0000 (20:02 +0000)
avoids problems when the desired input string is const.

lib/cgraph/agxbuf.c
lib/cgraph/agxbuf.h
lib/graph/agxbuf.c
lib/graph/agxbuf.h

index 7561f066de97d176a73e87586bc2177d40a53f5e..c12ab6558d16f230a7ee9f66fe845e3fc4dd6be8 100644 (file)
@@ -69,7 +69,7 @@ int agxbmore(agxbuf * xb, unsigned int ssz)
 /* agxbput_n:
  * Append string s of length n onto xb
  */
-int agxbput_n(agxbuf * xb, char *s, unsigned int ssz)
+int agxbput_n(agxbuf * xb, const char *s, unsigned int ssz)
 {
     if (xb->ptr + ssz > xb->eptr)
        agxbmore(xb, ssz);
@@ -81,7 +81,7 @@ int agxbput_n(agxbuf * xb, char *s, unsigned int ssz)
 /* agxbput:
  * Append string s into xb
  */
-int agxbput(agxbuf * xb, char *s)
+int agxbput(agxbuf * xb, const char *s)
 {
     unsigned int ssz = strlen(s);
 
index 857b1a1104f21fc07ca246cec9d4a3598c7dcf6e..9ffc39026a61339e3b691dfd46e57bbca5a76bfa 100644 (file)
@@ -38,12 +38,12 @@ extern "C" {
 /* agxbput_n:
  * Append string s of length n into xb
  */
-    extern int agxbput_n(agxbuf * xb, char *s, unsigned int n);
+    extern int agxbput_n(agxbuf * xb, const char *s, unsigned int n);
 
 /* agxbput:
  * Append string s into xb
  */
-    extern int agxbput(agxbuf * xb, char *s);
+    extern int agxbput(agxbuf * xb, const char *s);
 
 /* agxbfree:
  * Free any malloced resources.
index db983fdd4ac2b4822783b841a58871130e34e250..3abd8ad35de58a92329969f9e3dd0bb399190d24 100644 (file)
@@ -69,7 +69,7 @@ int agxbmore(agxbuf * xb, unsigned int ssz)
 /* agxbput_n:
  * Append string s of length n onto xb
  */
-int agxbput_n(agxbuf * xb, char *s, unsigned int ssz)
+int agxbput_n(agxbuf * xb, const char *s, unsigned int ssz)
 {
     if (xb->ptr + ssz > xb->eptr)
        agxbmore(xb, ssz);
@@ -81,7 +81,7 @@ int agxbput_n(agxbuf * xb, char *s, unsigned int ssz)
 /* agxbput:
  * Append string s into xb
  */
-int agxbput(agxbuf * xb, char *s)
+int agxbput(agxbuf * xb, const char *s)
 {
     unsigned int ssz = strlen(s);
 
index 857b1a1104f21fc07ca246cec9d4a3598c7dcf6e..9ffc39026a61339e3b691dfd46e57bbca5a76bfa 100644 (file)
@@ -38,12 +38,12 @@ extern "C" {
 /* agxbput_n:
  * Append string s of length n into xb
  */
-    extern int agxbput_n(agxbuf * xb, char *s, unsigned int n);
+    extern int agxbput_n(agxbuf * xb, const char *s, unsigned int n);
 
 /* agxbput:
  * Append string s into xb
  */
-    extern int agxbput(agxbuf * xb, char *s);
+    extern int agxbput(agxbuf * xb, const char *s);
 
 /* agxbfree:
  * Free any malloced resources.