From 18bed1e391ab6693759160eb12bdfbca430c9d8e Mon Sep 17 00:00:00 2001 From: erg Date: Sat, 26 Feb 2011 20:02:10 +0000 Subject: [PATCH] Add const modifier to string insert functions. This is correct, and avoids problems when the desired input string is const. --- lib/cgraph/agxbuf.c | 4 ++-- lib/cgraph/agxbuf.h | 4 ++-- lib/graph/agxbuf.c | 4 ++-- lib/graph/agxbuf.h | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/cgraph/agxbuf.c b/lib/cgraph/agxbuf.c index 7561f066d..c12ab6558 100644 --- a/lib/cgraph/agxbuf.c +++ b/lib/cgraph/agxbuf.c @@ -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); diff --git a/lib/cgraph/agxbuf.h b/lib/cgraph/agxbuf.h index 857b1a110..9ffc39026 100644 --- a/lib/cgraph/agxbuf.h +++ b/lib/cgraph/agxbuf.h @@ -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. diff --git a/lib/graph/agxbuf.c b/lib/graph/agxbuf.c index db983fdd4..3abd8ad35 100644 --- a/lib/graph/agxbuf.c +++ b/lib/graph/agxbuf.c @@ -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); diff --git a/lib/graph/agxbuf.h b/lib/graph/agxbuf.h index 857b1a110..9ffc39026 100644 --- a/lib/graph/agxbuf.h +++ b/lib/graph/agxbuf.h @@ -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. -- 2.40.0