Sprinkle const.
This commit is contained in:
parent
a15cb55d9e
commit
72efe4fb6f
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: error.h,v 1.12 2009/08/13 03:07:49 dholland Exp $ */
|
||||
/* $NetBSD: error.h,v 1.13 2009/08/13 03:50:02 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
|
@ -115,7 +115,7 @@ extern char *scriptname;
|
|||
|
||||
extern boolean query;
|
||||
extern boolean terse;
|
||||
int inquire(char *, ...); /* inquire for yes/no */
|
||||
int inquire(const char *, ...); /* inquire for yes/no */
|
||||
|
||||
/*
|
||||
* codes for inquire() to return
|
||||
|
@ -131,8 +131,8 @@ int inquire(char *, ...); /* inquire for yes/no */
|
|||
*/
|
||||
struct lang_desc {
|
||||
char *lang_name;
|
||||
char *lang_incomment; /* one of the following defines */
|
||||
char *lang_outcomment; /* one of the following defines */
|
||||
const char *lang_incomment; /* one of the following defines */
|
||||
const char *lang_outcomment; /* one of the following defines */
|
||||
};
|
||||
extern struct lang_desc lang_table[];
|
||||
|
||||
|
@ -212,19 +212,19 @@ void eaterrors(int *, Eptr **);
|
|||
void erroradd(int, char **, Errorclass, Errorclass);
|
||||
void filenames(int, Eptr **);
|
||||
void findfiles(int, Eptr *, int *, Eptr ***);
|
||||
char firstchar(char *);
|
||||
void getignored(char *);
|
||||
char lastchar(char *);
|
||||
char next_lastchar(char *);
|
||||
char firstchar(const char *);
|
||||
void getignored(const char *);
|
||||
char lastchar(const char *);
|
||||
char next_lastchar(const char *);
|
||||
void onintr(int);
|
||||
boolean persperdexplode(char *, char **, char **);
|
||||
Errorclass pi(void);
|
||||
int position(char *, char);
|
||||
int position(const char *, char);
|
||||
void printerrors(boolean, int, Eptr []);
|
||||
char *plural(int);
|
||||
const char *plural(int);
|
||||
char *substitute(char *, char, char);
|
||||
boolean touchfiles(int, Eptr **, int *, char ***);
|
||||
char *verbform(int);
|
||||
const char *verbform(int);
|
||||
void wordvbuild(char *, int*, char ***);
|
||||
int wordvcmp(char **, int, char **);
|
||||
void wordvprint(FILE *, int, char **);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: filter.c,v 1.12 2009/08/13 03:07:49 dholland Exp $ */
|
||||
/* $NetBSD: filter.c,v 1.13 2009/08/13 03:50:02 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
|
@ -34,7 +34,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)filter.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
__RCSID("$NetBSD: filter.c,v 1.12 2009/08/13 03:07:49 dholland Exp $");
|
||||
__RCSID("$NetBSD: filter.c,v 1.13 2009/08/13 03:50:02 dholland Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -47,7 +47,7 @@ __RCSID("$NetBSD: filter.c,v 1.12 2009/08/13 03:07:49 dholland Exp $");
|
|||
#include "error.h"
|
||||
#include "pathnames.h"
|
||||
|
||||
static char *lint_libs[] = {
|
||||
static const char *lint_libs[] = {
|
||||
IG_FILE1,
|
||||
IG_FILE2,
|
||||
IG_FILE3,
|
||||
|
@ -56,21 +56,21 @@ static char *lint_libs[] = {
|
|||
};
|
||||
|
||||
static int lexsort(const void *, const void *);
|
||||
static int search_ignore(char *);
|
||||
static int search_ignore(const char *);
|
||||
|
||||
/*
|
||||
* Read the file ERRORNAME of the names of functions in lint
|
||||
* to ignore complaints about.
|
||||
*/
|
||||
void
|
||||
getignored(char *auxname)
|
||||
getignored(const char *auxname)
|
||||
{
|
||||
int i;
|
||||
FILE *fyle;
|
||||
char inbuffer[256];
|
||||
uid_t uid;
|
||||
char filename[MAXPATHLEN];
|
||||
char *username;
|
||||
const char *username;
|
||||
struct passwd *passwdentry;
|
||||
|
||||
nignored = 0;
|
||||
|
@ -134,15 +134,16 @@ getignored(char *auxname)
|
|||
static int
|
||||
lexsort(const void *c1, const void *c2)
|
||||
{
|
||||
char **cpp1, **cpp2;
|
||||
const char *const *cpp1;
|
||||
const char *const *cpp2;
|
||||
|
||||
cpp1 = (char **)c1;
|
||||
cpp2 = (char **)c2;
|
||||
cpp1 = c1;
|
||||
cpp2 = c2;
|
||||
return (strcmp(*cpp1, *cpp2));
|
||||
}
|
||||
|
||||
static int
|
||||
search_ignore(char *key)
|
||||
search_ignore(const char *key)
|
||||
{
|
||||
int ub, lb;
|
||||
int halfway;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: input.c,v 1.13 2009/08/13 03:07:49 dholland Exp $ */
|
||||
/* $NetBSD: input.c,v 1.14 2009/08/13 03:50:02 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
|
@ -34,7 +34,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)input.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
__RCSID("$NetBSD: input.c,v 1.13 2009/08/13 03:07:49 dholland Exp $");
|
||||
__RCSID("$NetBSD: input.c,v 1.14 2009/08/13 03:50:02 dholland Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -70,7 +70,7 @@ eaterrors(int *r_errorc, Eptr **r_errorv)
|
|||
{
|
||||
Errorclass errorclass = C_SYNC;
|
||||
char *line;
|
||||
char *inbuffer;
|
||||
const char *inbuffer;
|
||||
size_t inbuflen;
|
||||
|
||||
for (;;) {
|
||||
|
@ -121,7 +121,7 @@ erroradd(int errorlength, char **errorv, Errorclass errorclass,
|
|||
Errorclass errorsubclass)
|
||||
{
|
||||
Eptr newerror;
|
||||
char *cp;
|
||||
const char *cp;
|
||||
|
||||
if (errorclass == C_TRUE) {
|
||||
/* check canonicalization of the second argument*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: main.c,v 1.14 2009/08/13 03:10:03 dholland Exp $ */
|
||||
/* $NetBSD: main.c,v 1.15 2009/08/13 03:50:02 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
|
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
__RCSID("$NetBSD: main.c,v 1.14 2009/08/13 03:10:03 dholland Exp $");
|
||||
__RCSID("$NetBSD: main.c,v 1.15 2009/08/13 03:50:02 dholland Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <signal.h>
|
||||
|
@ -274,7 +274,8 @@ try(char *name, int argc, char **argv)
|
|||
static int
|
||||
errorsort(const void *x1, const void *x2)
|
||||
{
|
||||
Eptr *epp1 = (Eptr *)x1, *epp2 = (Eptr *)x2;
|
||||
const Eptr *epp1 = x1;
|
||||
const Eptr *epp2 = x2;
|
||||
Eptr ep1, ep2;
|
||||
int order;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pi.c,v 1.14 2009/08/13 03:07:49 dholland Exp $ */
|
||||
/* $NetBSD: pi.c,v 1.15 2009/08/13 03:50:02 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
|
@ -34,7 +34,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)pi.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
__RCSID("$NetBSD: pi.c,v 1.14 2009/08/13 03:07:49 dholland Exp $");
|
||||
__RCSID("$NetBSD: pi.c,v 1.15 2009/08/13 03:50:02 dholland Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -47,10 +47,10 @@ static char *c_linenumber;
|
|||
static char *unk_hdr[] = {"In", "program", "???"};
|
||||
static char **c_header = &unk_hdr[0];
|
||||
|
||||
static boolean alldigits(char *);
|
||||
static boolean alldigits(const char *);
|
||||
static boolean isdateformat(int, char **);
|
||||
static boolean instringset(char *, char **);
|
||||
static boolean piptr(char *);
|
||||
static boolean instringset(const char *, char **);
|
||||
static boolean piptr(const char *);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -163,7 +163,7 @@ static char *pi_imp1[] = {"improperly", "used", "on", "line"};
|
|||
static char *pi_imp2[] = {"improperly", "used", "on", "lines"};
|
||||
|
||||
static boolean
|
||||
alldigits(char *string)
|
||||
alldigits(const char *string)
|
||||
{
|
||||
for (; *string && isdigit((unsigned char)*string); string++)
|
||||
continue;
|
||||
|
@ -171,7 +171,7 @@ alldigits(char *string)
|
|||
}
|
||||
|
||||
static boolean
|
||||
instringset(char *member, char **set)
|
||||
instringset(const char *member, char **set)
|
||||
{
|
||||
for (; *set; set++) {
|
||||
if (strcmp(*set, member) == 0)
|
||||
|
@ -192,7 +192,7 @@ isdateformat(int wordc, char **wordv)
|
|||
}
|
||||
|
||||
static boolean
|
||||
piptr(char *string)
|
||||
piptr(const char *string)
|
||||
{
|
||||
if (*string != '-')
|
||||
return (FALSE);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: subr.c,v 1.16 2009/08/13 03:07:49 dholland Exp $ */
|
||||
/* $NetBSD: subr.c,v 1.17 2009/08/13 03:50:02 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
|
@ -34,7 +34,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)subr.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
__RCSID("$NetBSD: subr.c,v 1.16 2009/08/13 03:07:49 dholland Exp $");
|
||||
__RCSID("$NetBSD: subr.c,v 1.17 2009/08/13 03:50:02 dholland Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <ctype.h>
|
||||
|
@ -85,7 +85,7 @@ Calloc(int nelements, int size)
|
|||
* (one based)
|
||||
*/
|
||||
int
|
||||
position(char *string, char ch)
|
||||
position(const char *string, char ch)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -117,7 +117,7 @@ substitute(char *string, char chold, char chnew)
|
|||
}
|
||||
|
||||
char
|
||||
lastchar(char *string)
|
||||
lastchar(const char *string)
|
||||
{
|
||||
int length;
|
||||
|
||||
|
@ -131,7 +131,7 @@ lastchar(char *string)
|
|||
}
|
||||
|
||||
char
|
||||
firstchar(char *string)
|
||||
firstchar(const char *string)
|
||||
{
|
||||
if (string)
|
||||
return (string[0]);
|
||||
|
@ -140,7 +140,7 @@ firstchar(char *string)
|
|||
}
|
||||
|
||||
char
|
||||
next_lastchar(char *string)
|
||||
next_lastchar(const char *string)
|
||||
{
|
||||
int length;
|
||||
|
||||
|
@ -291,7 +291,7 @@ void
|
|||
wordvprint(FILE *fyle, int wordc, char **wordv)
|
||||
{
|
||||
int i;
|
||||
char *sep = "";
|
||||
const char *sep = "";
|
||||
|
||||
for (i = 0; i < wordc; i++)
|
||||
if (wordv[i]) {
|
||||
|
@ -384,16 +384,16 @@ wordvsplice(int emptyhead, int wordc, char **wordv)
|
|||
/*
|
||||
* plural'ize and verb forms
|
||||
*/
|
||||
static char *S = "s";
|
||||
static char *N = "";
|
||||
static const char *S = "s";
|
||||
static const char *N = "";
|
||||
|
||||
char *
|
||||
const char *
|
||||
plural(int n)
|
||||
{
|
||||
return (n > 1 ? S : N);
|
||||
}
|
||||
|
||||
char *
|
||||
const char *
|
||||
verbform(int n)
|
||||
{
|
||||
return (n > 1 ? N : S);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: touch.c,v 1.18 2009/08/13 03:07:49 dholland Exp $ */
|
||||
/* $NetBSD: touch.c,v 1.19 2009/08/13 03:50:02 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
|
@ -34,7 +34,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)touch.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif
|
||||
__RCSID("$NetBSD: touch.c,v 1.18 2009/08/13 03:07:49 dholland Exp $");
|
||||
__RCSID("$NetBSD: touch.c,v 1.19 2009/08/13 03:50:02 dholland Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -71,20 +71,20 @@ extern char *suffixlist;
|
|||
|
||||
static int countfiles(Eptr *);
|
||||
static int nopertain(Eptr **);
|
||||
static void hackfile(char *, Eptr **, int, int);
|
||||
static boolean preview(char *, int, Eptr **, int);
|
||||
static int settotouch(char *);
|
||||
static void diverterrors(char *, int, Eptr **, int, boolean, int);
|
||||
static int oktotouch(char *);
|
||||
static void hackfile(const char *, Eptr **, int, int);
|
||||
static boolean preview(const char *, int, Eptr **, int);
|
||||
static int settotouch(const char *);
|
||||
static void diverterrors(const char *, int, Eptr **, int, boolean, int);
|
||||
static int oktotouch(const char *);
|
||||
static void execvarg(int, int *, char ***);
|
||||
static boolean edit(char *);
|
||||
static boolean edit(const char *);
|
||||
static void insert(int);
|
||||
static void text(Eptr, boolean);
|
||||
static boolean writetouched(int);
|
||||
static int mustoverwrite(FILE *, FILE *);
|
||||
static int mustwrite(char *, int, FILE *);
|
||||
static int mustwrite(const char *, int, FILE *);
|
||||
static void errorprint(FILE *, Eptr, boolean);
|
||||
static int probethisfile(char *);
|
||||
static int probethisfile(const char *);
|
||||
|
||||
void
|
||||
findfiles(int nerrors, Eptr *errors, int *r_nfiles, Eptr ***r_files)
|
||||
|
@ -92,7 +92,7 @@ findfiles(int nerrors, Eptr *errors, int *r_nfiles, Eptr ***r_files)
|
|||
int nfiles;
|
||||
Eptr **files;
|
||||
|
||||
char *name;
|
||||
const char *name;
|
||||
int ei;
|
||||
int fi;
|
||||
Eptr errorp;
|
||||
|
@ -139,7 +139,7 @@ findfiles(int nerrors, Eptr *errors, int *r_nfiles, Eptr ***r_files)
|
|||
static int
|
||||
countfiles(Eptr *errors)
|
||||
{
|
||||
char *name;
|
||||
const char *name;
|
||||
int ei;
|
||||
Eptr errorp;
|
||||
int nfiles;
|
||||
|
@ -175,7 +175,7 @@ void
|
|||
filenames(int nfiles, Eptr **files)
|
||||
{
|
||||
int fi;
|
||||
char *sep = " ";
|
||||
const char *sep = " ";
|
||||
int someerrors;
|
||||
|
||||
/*
|
||||
|
@ -245,7 +245,7 @@ extern boolean notouch;
|
|||
boolean
|
||||
touchfiles(int nfiles, Eptr **files, int *r_edargc, char ***r_edargv)
|
||||
{
|
||||
char *name;
|
||||
const char *name;
|
||||
Eptr errorp;
|
||||
int fi;
|
||||
Eptr *erpp;
|
||||
|
@ -299,7 +299,7 @@ touchfiles(int nfiles, Eptr **files, int *r_edargc, char ***r_edargv)
|
|||
}
|
||||
|
||||
static void
|
||||
hackfile(char *name, Eptr **files, int ix, int nerrors)
|
||||
hackfile(const char *name, Eptr **files, int ix, int nerrors)
|
||||
{
|
||||
boolean previewed;
|
||||
int errordest; /* where errors go */
|
||||
|
@ -329,7 +329,7 @@ hackfile(char *name, Eptr **files, int ix, int nerrors)
|
|||
}
|
||||
|
||||
static boolean
|
||||
preview(char *name, int nerrors, Eptr **files, int ix)
|
||||
preview(const char *name, int nerrors, Eptr **files, int ix)
|
||||
{
|
||||
int back;
|
||||
Eptr *erpp;
|
||||
|
@ -358,7 +358,7 @@ preview(char *name, int nerrors, Eptr **files, int ix)
|
|||
}
|
||||
|
||||
static int
|
||||
settotouch(char *name)
|
||||
settotouch(const char *name)
|
||||
{
|
||||
int dest = TOSTDOUT;
|
||||
|
||||
|
@ -408,8 +408,8 @@ settotouch(char *name)
|
|||
}
|
||||
|
||||
static void
|
||||
diverterrors(char *name, int dest, Eptr **files, int ix, boolean previewed,
|
||||
int nterrors)
|
||||
diverterrors(const char *name, int dest, Eptr **files, int ix,
|
||||
boolean previewed, int nterrors)
|
||||
{
|
||||
int nerrors;
|
||||
Eptr *erpp;
|
||||
|
@ -448,11 +448,11 @@ diverterrors(char *name, int dest, Eptr **files, int ix, boolean previewed,
|
|||
}
|
||||
|
||||
static int
|
||||
oktotouch(char *filename)
|
||||
oktotouch(const char *filename)
|
||||
{
|
||||
char *src;
|
||||
const char *src;
|
||||
char *pat;
|
||||
char *osrc;
|
||||
const char *osrc;
|
||||
|
||||
pat = suffixlist;
|
||||
if (pat == 0)
|
||||
|
@ -503,7 +503,7 @@ static void
|
|||
execvarg(int n_pissed_on, int *r_argc, char ***r_argv)
|
||||
{
|
||||
Eptr p;
|
||||
char *sep;
|
||||
const char *sep;
|
||||
int fi;
|
||||
|
||||
sep = NULL;
|
||||
|
@ -532,7 +532,7 @@ execvarg(int n_pissed_on, int *r_argc, char ***r_argv)
|
|||
|
||||
static FILE *o_touchedfile; /* the old file */
|
||||
static FILE *n_touchedfile; /* the new file */
|
||||
static char *o_name;
|
||||
static const char *o_name;
|
||||
static char n_name[MAXPATHLEN];
|
||||
static int o_lineno;
|
||||
static int n_lineno;
|
||||
|
@ -543,7 +543,7 @@ static boolean tempfileopen = FALSE;
|
|||
* Well, if it isn't, then return TRUE if something failed
|
||||
*/
|
||||
static boolean
|
||||
edit(char *name)
|
||||
edit(const char *name)
|
||||
{
|
||||
int fd;
|
||||
const char *tmpdir;
|
||||
|
@ -689,7 +689,7 @@ mustoverwrite(FILE *preciousfile, FILE *tmpfile)
|
|||
* return 0 on catastrophe
|
||||
*/
|
||||
static int
|
||||
mustwrite(char *base, int n, FILE *preciousfile)
|
||||
mustwrite(const char *base, int n, FILE *preciousfile)
|
||||
{
|
||||
int nwrote;
|
||||
|
||||
|
@ -761,7 +761,7 @@ errorprint(FILE *place, Eptr errorp, boolean print_all)
|
|||
}
|
||||
|
||||
int
|
||||
inquire(char *fmt, ...)
|
||||
inquire(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char buffer[128];
|
||||
|
@ -787,7 +787,7 @@ inquire(char *fmt, ...)
|
|||
}
|
||||
|
||||
static int
|
||||
probethisfile(char *name)
|
||||
probethisfile(const char *name)
|
||||
{
|
||||
struct stat statbuf;
|
||||
|
||||
|
|
Loading…
Reference in New Issue