Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/sup/source constification from Paul Ripke to make i...



details:   https://anonhg.NetBSD.org/src/rev/99d22b3610e6
branches:  trunk
changeset: 748207:99d22b3610e6
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Oct 16 12:41:37 2009 +0000

description:
constification from Paul Ripke to make it compile on OS/X

diffstat:

 usr.sbin/sup/source/log.c        |  12 +++++-----
 usr.sbin/sup/source/nxtarg.c     |  18 +++++++-------
 usr.sbin/sup/source/quit.c       |   4 +-
 usr.sbin/sup/source/scm.c        |  10 ++++----
 usr.sbin/sup/source/scmio.c      |  46 ++++++++++++++++++++--------------------
 usr.sbin/sup/source/skipto.c     |  14 ++++++------
 usr.sbin/sup/source/stree.c      |  31 +++++++++++++-------------
 usr.sbin/sup/source/supcmain.c   |  10 +++++---
 usr.sbin/sup/source/supcmeat.c   |   4 +-
 usr.sbin/sup/source/supcmisc.c   |   4 +-
 usr.sbin/sup/source/supextern.h  |  36 +++++++++++++++---------------
 usr.sbin/sup/source/supfilesrv.c |  10 ++++----
 usr.sbin/sup/source/supmsg.c     |  36 +++++++++++++++---------------
 usr.sbin/sup/source/supmsg.h     |   6 ++--
 14 files changed, 122 insertions(+), 119 deletions(-)

diffs (truncated from 816 to 300 lines):

diff -r b92da4651e36 -r 99d22b3610e6 usr.sbin/sup/source/log.c
--- a/usr.sbin/sup/source/log.c Fri Oct 16 12:05:19 2009 +0000
+++ b/usr.sbin/sup/source/log.c Fri Oct 16 12:41:37 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: log.c,v 1.9 2007/12/20 20:17:52 christos Exp $ */
+/*     $NetBSD: log.c,v 1.10 2009/10/16 12:41:37 christos Exp $        */
 
 /*
  * Copyright (c) 1992 Carnegie Mellon University
@@ -64,7 +64,7 @@
 }
 
 void
-logquit(int retval, char *fmt, ...)
+logquit(int retval, const char *fmt, ...)
 {
        char buf[STRINGLENGTH];
        va_list ap;
@@ -81,7 +81,7 @@
 }
 
 void
-logerr(char *fmt, ...)
+logerr(const char *fmt, ...)
 {
        char buf[STRINGLENGTH];
        va_list ap;
@@ -98,7 +98,7 @@
 }
 
 void
-loginfo(char *fmt, ...)
+loginfo(const char *fmt, ...)
 {
        char buf[STRINGLENGTH];
        va_list ap;
@@ -131,7 +131,7 @@
 int deny_severity = LIBWRAP_DENY_FACILITY | LIBWRAP_DENY_SEVERITY;
 
 void
-logdeny(char *fmt, ...)
+logdeny(const char *fmt, ...)
 {
        char buf[STRINGLENGTH];
        va_list ap;
@@ -148,7 +148,7 @@
 }
 
 void
-logallow(char *fmt, ...)
+logallow(const char *fmt, ...)
 {
        char buf[STRINGLENGTH];
        va_list ap;
diff -r b92da4651e36 -r 99d22b3610e6 usr.sbin/sup/source/nxtarg.c
--- a/usr.sbin/sup/source/nxtarg.c      Fri Oct 16 12:05:19 2009 +0000
+++ b/usr.sbin/sup/source/nxtarg.c      Fri Oct 16 12:41:37 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nxtarg.c,v 1.5 2002/07/10 20:19:41 wiz Exp $   */
+/*     $NetBSD: nxtarg.c,v 1.6 2009/10/16 12:41:37 christos Exp $      */
 
 /*
  * Copyright (c) 1991 Carnegie Mellon University
@@ -27,8 +27,8 @@
 /*
  *  nxtarg -- strip off arguments from a string
  *
- *  Usage:  p = nxtarg (&q,brk);
- *     char *p,*q,*brk;
+ *  Usage:  p = nxtarg (&q,sep);
+ *     char *p,*q,*sep;
  *     extern char _argbreak;
  *
  *     q is pointer to next argument in string
@@ -36,12 +36,12 @@
  *     q points to remainder of string
  *
  *  Leading blanks and tabs are skipped; the argument ends at the
- *  first occurence of one of the characters in the string "brk".
+ *  first occurence of one of the characters in the string "sep".
  *  When such a character is found, it is put into the external
  *  variable "_argbreak", and replaced by a null character; if the
  *  arg string ends before that, then the null character is
  *  placed into _argbreak;
- *  If "brk" is 0, then " " is substituted.
+ *  If "sep" is 0, then " " is substituted.
  *
  *  HISTORY
  * 01-Jul-83  Steven Shafer (sas) at Carnegie-Mellon University
@@ -60,7 +60,7 @@
 char _argbreak;
 
 char *
-nxtarg(char **q, char *brk)
+nxtarg(char **q, const char *sep)
 {
        char *front, *back;
        front = *q;             /* start of string */
@@ -68,9 +68,9 @@
        while (*front && (*front == ' ' || *front == '\t'))
                front++;
        /* find break character at end */
-       if (brk == 0)
-               brk = " ";
-       back = skipto(front, brk);
+       if (sep == 0)
+               sep = " ";
+       back = skipto(front, sep);
        _argbreak = *back;
        *q = (*back ? back + 1 : back); /* next arg start loc */
        /* elim trailing blanks and tabs */
diff -r b92da4651e36 -r 99d22b3610e6 usr.sbin/sup/source/quit.c
--- a/usr.sbin/sup/source/quit.c        Fri Oct 16 12:05:19 2009 +0000
+++ b/usr.sbin/sup/source/quit.c        Fri Oct 16 12:41:37 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: quit.c,v 1.5 2002/07/10 20:19:41 wiz Exp $     */
+/*     $NetBSD: quit.c,v 1.6 2009/10/16 12:41:37 christos Exp $        */
 
 /*
  * Copyright (c) 1991 Carnegie Mellon University
@@ -49,7 +49,7 @@
 #include "supextern.h"
 
 void
-quit(int status, char *fmt, ...)
+quit(int status, const char *fmt, ...)
 {
        va_list args;
 
diff -r b92da4651e36 -r 99d22b3610e6 usr.sbin/sup/source/scm.c
--- a/usr.sbin/sup/source/scm.c Fri Oct 16 12:05:19 2009 +0000
+++ b/usr.sbin/sup/source/scm.c Fri Oct 16 12:41:37 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: scm.c,v 1.26 2009/01/15 15:58:42 christos Exp $        */
+/*     $NetBSD: scm.c,v 1.27 2009/10/16 12:41:37 christos Exp $        */
 
 /*
  * Copyright (c) 1992 Carnegie Mellon University
@@ -373,7 +373,7 @@
        if (*b < 32)
                *b <<= 1;
        if (*t != -1) {
-               if (s > *t)
+               if (s > (unsigned) *t)
                        s = *t;
                *t -= s;
        }
@@ -486,7 +486,7 @@
        return (name);
 }
 
-char *
+const char *
 remotehost(void)
 {                              /* remote host name (if known) */
        char h1[NI_MAXHOST];
@@ -652,7 +652,7 @@
 }
 
 int 
-scmerr(int error, char *fmt, ...)
+scmerr(int error, const char *fmt, ...)
 {
        va_list ap;
 
@@ -692,7 +692,7 @@
                return (in);
        x.ui = in;
        iy = sizeof(int);
-       for (ix = 0; ix < sizeof(int); ix++) {
+       for (ix = 0; ix < (int) sizeof(int); ix++) {
                --iy;
                y.uc[iy] = x.uc[ix];
        }
diff -r b92da4651e36 -r 99d22b3610e6 usr.sbin/sup/source/scmio.c
--- a/usr.sbin/sup/source/scmio.c       Fri Oct 16 12:05:19 2009 +0000
+++ b/usr.sbin/sup/source/scmio.c       Fri Oct 16 12:41:37 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: scmio.c,v 1.16 2006/05/25 02:10:53 christos Exp $      */
+/*     $NetBSD: scmio.c,v 1.17 2009/10/16 12:41:37 christos Exp $      */
 
 /*
  * Copyright (c) 1992 Carnegie Mellon University
@@ -199,7 +199,7 @@
        char *b_ptr;            /* pointer to end of buffer */
        int b_cnt;              /* number of bytes in buffer */
 }   buffers[2];
-struct buf *bufptr;            /* buffer pointer */
+struct buf *gblbufptr;         /* buffer pointer */
 
 static int writedata(int, char *);
 static int writeblock(int, char *);
@@ -217,22 +217,22 @@
        int x, tries;
        struct buf *bp;
 
-       if (bufptr) {
-               if (bufptr->b_cnt + count <= FILEXFER) {
-                       memcpy(bufptr->b_ptr, data, count);
-                       bufptr->b_cnt += count;
-                       bufptr->b_ptr += count;
+       if (gblbufptr) {
+               if (gblbufptr->b_cnt + count <= FILEXFER) {
+                       memcpy(gblbufptr->b_ptr, data, count);
+                       gblbufptr->b_cnt += count;
+                       gblbufptr->b_ptr += count;
                        return (SCMOK);
                }
-               bp = (bufptr == buffers) ? &buffers[1] : buffers;
+               bp = (gblbufptr == buffers) ? &buffers[1] : buffers;
                memcpy(bp->b_data, data, count);
                bp->b_cnt = count;
                bp->b_ptr = bp->b_data + count;
-               data = bufptr->b_data;
-               count = bufptr->b_cnt;
-               bufptr->b_cnt = 0;
-               bufptr->b_ptr = bufptr->b_data;
-               bufptr = bp;
+               data = gblbufptr->b_data;
+               count = gblbufptr->b_cnt;
+               gblbufptr->b_cnt = 0;
+               gblbufptr->b_ptr = gblbufptr->b_data;
+               gblbufptr = bp;
        }
        tries = 0;
        for (;;) {
@@ -278,11 +278,11 @@
 
        if (scmdebug > 1)
                loginfo("SCM Writing message %d", msg);
-       if (bufptr)
+       if (gblbufptr)
                return (scmerr(-1, "Buffering already enabled"));
-       bufptr = buffers;
-       bufptr->b_ptr = bufptr->b_data;
-       bufptr->b_cnt = 0;
+       gblbufptr = buffers;
+       gblbufptr->b_ptr = gblbufptr->b_data;
+       gblbufptr->b_cnt = 0;
        x = byteswap(msg);
        return (writedata(sizeof(int), (char *) &x));
 }
@@ -298,15 +298,15 @@
        x = writedata(sizeof(int), (char *) &x);
        if (x != SCMOK)
                return (x);
-       if (bufptr == NULL)
+       if (gblbufptr == NULL)
                return (scmerr(-1, "Buffering already disabled"));
-       if (bufptr->b_cnt == 0) {
-               bufptr = NULL;
+       if (gblbufptr->b_cnt == 0) {
+               gblbufptr = NULL;
                return (SCMOK);
        }
-       data = bufptr->b_data;
-       count = bufptr->b_cnt;
-       bufptr = NULL;
+       data = gblbufptr->b_data;
+       count = gblbufptr->b_cnt;
+       gblbufptr = NULL;
        return (writedata(count, data));
 }
 
diff -r b92da4651e36 -r 99d22b3610e6 usr.sbin/sup/source/skipto.c
--- a/usr.sbin/sup/source/skipto.c      Fri Oct 16 12:05:19 2009 +0000
+++ b/usr.sbin/sup/source/skipto.c      Fri Oct 16 12:41:37 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: skipto.c,v 1.5 2002/07/10 20:19:43 wiz Exp $   */
+/*     $NetBSD: skipto.c,v 1.6 2009/10/16 12:41:37 christos Exp $      */
 
 /*
  * Copyright (c) 1991 Carnegie Mellon University
@@ -58,9 +58,9 @@
 static char tab[256] = { 0 };
 
 char *
-skipto(char *string, char *charset)
+skipto(const char *string, const char *charset)
 {
-       char *setp, *strp;
+       const char *setp, *strp;
 
        tab[0] = 1;             /* Stop on a null, too. */
        for (setp = charset; *setp; setp++)
@@ -69,13 +69,13 @@
                continue;
        for (setp = charset; *setp; setp++)
                tab[(unsigned char) *setp] = 0;
-       return strp;
+       return __UNCONST(strp);
 }
 
 char *
-skipover(char *string, char *charset)
+skipover(const char *string, const char *charset)
 {
-       char *setp, *strp;
+       const char *setp, *strp;
 



Home | Main Index | Thread Index | Old Index