`const'ification of inndcomm

Alex Kiernan alexk at demon.net
Wed Mar 7 10:31:47 UTC 2001



To allow removal of a bunch of pointless (char *) casts, here's a
patch for making inndcomm use const where it can:

Index: include/inndcomm.h
===================================================================
RCS file: /upstream-repositories/inn-cvs.isc.org/inn/include/inndcomm.h,v
retrieving revision 1.10
diff -u -r1.10 inndcomm.h
--- include/inndcomm.h	2001/02/03 03:51:35	1.10
+++ include/inndcomm.h	2001/03/07 10:28:30
@@ -72,11 +72,11 @@
 extern void		ICCsettimeout(int i);
 extern int		ICCopen(void);
 extern int		ICCclose(void);
-extern int		ICCcommand(char cmd, char *argv[], char **replyp);
-extern int		ICCcancel(char *msgid);
-extern int		ICCgo(char *why);
-extern int		ICCpause(char *why);
-extern int		ICCreserve(char *why);
+extern int		ICCcommand(char cmd, const char *argv[], char **replyp);
+extern int		ICCcancel(const char *msgid);
+extern int		ICCgo(const char *why);
+extern int		ICCpause(const char *why);
+extern int		ICCreserve(const char *why);
 
 extern const char	*ICCfailure;
 
Index: lib/inndcomm.c
===================================================================
RCS file: /upstream-repositories/inn-cvs.isc.org/inn/lib/inndcomm.c,v
retrieving revision 1.12
diff -u -r1.12 inndcomm.c
--- lib/inndcomm.c	2000/10/31 16:28:51	1.12
+++ lib/inndcomm.c	2001/03/07 10:28:30
@@ -188,11 +188,11 @@
 */
 
 int
-ICCcommand(char cmd, char *argv[], char **replyp)
+ICCcommand(char cmd, const char *argv[], char **replyp)
 {
     char		*buff;
     char		*p;
-    char		*q;
+    const char		*q;
     char		save;
     int			bufsiz;
     int			i ;
@@ -215,8 +215,8 @@
 
     /* Get the length of the buffer. */
     bufsiz = strlen(ICCsockname) + 1 + 1;
-    for (i = 0; (p = argv[i]) != NULL; i++)
-	bufsiz += 1 + strlen(p);
+    for (i = 0; (q = argv[i]) != NULL; i++)
+	bufsiz += 1 + strlen(q);
     bufsiz += HEADER_SIZE ;
     if (bufsiz < MIN_BUFFER_SIZE)
 	bufsiz = MIN_BUFFER_SIZE;
@@ -405,9 +405,9 @@
 **  Send a "cancel" command.
 */
 int
-ICCcancel(char *msgid)
+ICCcancel(const char *msgid)
 {
-    char	*args[2];
+    const char	*args[2];
 
     args[0] = msgid;
     args[1] = NULL;
@@ -419,9 +419,9 @@
 **  Send a "go" command.
 */
 int
-ICCgo(char *why)
+ICCgo(const char *why)
 {
-    char	*args[2];
+    const char	*args[2];
 
     args[0] = why;
     args[1] = NULL;
@@ -433,9 +433,9 @@
 **  Send a "pause" command.
 */
 int
-ICCpause(char *why)
+ICCpause(const char *why)
 {
-    char	*args[2];
+    const char	*args[2];
 
     args[0] = why;
     args[1] = NULL;
@@ -447,9 +447,9 @@
 **  Send a "reserve" command.
 */
 int
-ICCreserve(char *why)
+ICCreserve(const char *why)
 {
-    char	*args[2];
+    const char	*args[2];
 
     args[0] = why;
     args[1] = NULL;


-- 
Alex Kiernan, Principal Engineer, Development, Thus PLC


More information about the inn-patches mailing list