changeset 1576:716bbba83929

Constify arguments.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 03 Sep 2007 08:43:47 +0300
parents 71a2e6b5b713
children bdf7935a2e26
files src/sid/xs_support.c src/sid/xs_support.h
diffstat 2 files changed, 16 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/sid/xs_support.c	Mon Sep 03 07:06:15 2007 +0300
+++ b/src/sid/xs_support.c	Mon Sep 03 08:43:47 2007 +0300
@@ -144,9 +144,10 @@
 
 /* Copy a string
  */
-gchar *xs_strncpy(gchar *pDest, gchar *pSource, size_t n)
+gchar *xs_strncpy(gchar *pDest, const gchar *pSource, size_t n)
 {
-	gchar *s, *d;
+	const gchar *s;
+	gchar *d;
 	size_t i;
 
 	/* Check the string pointers */
@@ -224,10 +225,11 @@
 /* Concatenate a given string up to given dest size or \n.
  * If size max is reached, change the end to "..."
  */
-void xs_pnstrcat(gchar *pDest, size_t iSize, gchar *pStr)
+void xs_pnstrcat(gchar *pDest, size_t iSize, const gchar *pStr)
 {
 	size_t i, n;
-	gchar *s, *d;
+	const gchar *s;
+	gchar *d;
 
 	d = pDest;
 	i = 0;
@@ -262,7 +264,7 @@
 
 /* Locate character in string
  */
-gchar *xs_strrchr(gchar *pcStr, gchar ch)
+gchar *xs_strrchr(gchar *pcStr, const gchar ch)
 {
 	gchar *lastPos = NULL;
 
@@ -276,21 +278,21 @@
 }
 
 
-void xs_findnext(gchar *pcStr, size_t *piPos)
+void xs_findnext(const gchar *pcStr, size_t *piPos)
 {
 	while (pcStr[*piPos] && isspace(pcStr[*piPos]))
 		(*piPos)++;
 }
 
 
-void xs_findeol(gchar *pcStr, size_t *piPos)
+void xs_findeol(const gchar *pcStr, size_t *piPos)
 {
 	while (pcStr[*piPos] && (pcStr[*piPos] != '\n') && (pcStr[*piPos] != '\r'))
 		(*piPos)++;
 }
 
 
-void xs_findnum(gchar *pcStr, size_t *piPos)
+void xs_findnum(const gchar *pcStr, size_t *piPos)
 {
 	while (pcStr[*piPos] && isdigit(pcStr[*piPos]))
 		(*piPos)++;
--- a/src/sid/xs_support.h	Mon Sep 03 07:06:15 2007 +0300
+++ b/src/sid/xs_support.h	Mon Sep 03 08:43:47 2007 +0300
@@ -97,14 +97,14 @@
 
 /* Misc functions
  */
-gchar	*xs_strncpy(gchar *, gchar *, size_t);
+gchar	*xs_strncpy(gchar *, const gchar *, size_t);
 gint	xs_pstrcpy(gchar **, const gchar *);
 gint	xs_pstrcat(gchar **, const gchar *);
-void	xs_pnstrcat(gchar *, size_t, gchar *);
-gchar	*xs_strrchr(gchar *, gchar);
-void	xs_findnext(gchar *, size_t *);
-void	xs_findeol(gchar *, size_t *);
-void	xs_findnum(gchar *, size_t *);
+void	xs_pnstrcat(gchar *, size_t, const gchar *);
+gchar	*xs_strrchr(gchar *, const gchar);
+void	xs_findnext(const gchar *, size_t *);
+void	xs_findeol(const gchar *, size_t *);
+void	xs_findnum(const gchar *, size_t *);
 
 #ifdef HAVE_MEMSET
 #define	xs_memset memset