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 - use const where appropriate



details:   https://anonhg.NetBSD.org/src/rev/cb6784a295e2
branches:  trunk
changeset: 748093:cb6784a295e2
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Oct 13 12:11:19 2009 +0000

description:
- use const where appropriate
- don't cast return value from malloc

diffstat:

 usr.sbin/sup/source/expand.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (45 lines):

diff -r 77c76119a5a0 -r cb6784a295e2 usr.sbin/sup/source/expand.c
--- a/usr.sbin/sup/source/expand.c      Tue Oct 13 11:56:16 2009 +0000
+++ b/usr.sbin/sup/source/expand.c      Tue Oct 13 12:11:19 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: expand.c,v 1.16 2007/07/20 16:39:05 christos Exp $     */
+/*     $NetBSD: expand.c,v 1.17 2009/10/13 12:11:19 christos Exp $     */
 
 /*
  * Copyright (c) 1991 Carnegie Mellon University
@@ -80,7 +80,7 @@
 static char pathbuf[MAXPATHLEN];
 static char *path, *pathp, *lastpathp;
 
-static char *globchars = "{[*?";/* meta characters */
+static const char globchars[] = "{[*?";/* meta characters */
 static char *entp;             /* current dir entry pointer */
 
 static char **BUFFER;          /* pointer to the buffer */
@@ -95,7 +95,7 @@
 static int execbrc(char *, char *);
 static int match(char *, char *);
 static int amatch(char *, char *);
-static void addone(char *, char *);
+static void addone(char *, const char *);
 static int addpath(char);
 static int gethdir(char *, int);
 
@@ -361,7 +361,7 @@
 }
 
 static void 
-addone(char *s1, char *s2)
+addone(char *s1, const char *s2)
 {
        char *ep;
 
@@ -369,7 +369,7 @@
                bufcnt = BUFSIZE + 1;
                longjmp(sjbuf, 1);
        }
-       ep = (char *) malloc(strlen(s1) + strlen(s2) + 1);
+       ep = malloc(strlen(s1) + strlen(s2) + 1);
        if (ep == 0) {
                bufcnt = -1;
                longjmp(sjbuf, 1);



Home | Main Index | Thread Index | Old Index