Add a bunch of const qualifiers.

This commit is contained in:
David F. Skoll
2008-01-26 21:55:58 -05:00
parent b6883c8a45
commit ba3e01f2ce
15 changed files with 41 additions and 39 deletions

View File

@@ -588,7 +588,7 @@ static int DoCalRem(ParsePtr p, int col)
int jul;
CalEntry *CurCol = CalColumn[col];
CalEntry *e;
char *s, *s2;
char const *s, *s2;
DynamicBuffer buf, obuf, pre_buf;
Token tok;

View File

@@ -555,7 +555,7 @@ int TriggerReminder(ParsePtr p, Trigger *t, TimeTrig *tim, int jul)
char tmpBuf[64];
DynamicBuffer buf, calRow;
DynamicBuffer pre_buf;
char *s;
char const *s;
Value v;
DBufInit(&buf);
@@ -812,7 +812,8 @@ int DoSatRemind(Trigger *trig, TimeTrig *tim, ParsePtr p)
{
int iter, jul, r;
Value v;
char *s, *t;
char const *s;
char const *t;
t = p->pos;
iter = 0;
@@ -951,7 +952,7 @@ static int ShouldTriggerBasedOnWarn(Trigger *t, int jul)
{
char buffer[VAR_NAME_LEN+32];
int i;
char *s;
char const *s;
int r;
Value v;
int lastReturnVal = 0; /* Silence compiler warning */

View File

@@ -649,7 +649,7 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
/* default triggers and a mode of NORMAL_MODE. */
/* */
/***************************************************************/
int DoSubstFromString(char *source, DynamicBuffer *dbuf,
int DoSubstFromString(char const *source, DynamicBuffer *dbuf,
int jul, int tim)
{
Trigger tempTrig;

View File

@@ -102,7 +102,7 @@ int DBufPutcFN(DynamicBuffer *dbuf, char c)
%DESCRIPTION:
Appends a string to the buffer.
**********************************************************************/
int DBufPuts(DynamicBuffer *dbuf, char *str)
int DBufPuts(DynamicBuffer *dbuf, char const *str)
{
int l = strlen(str);
if (!l) return OK;

View File

@@ -25,7 +25,7 @@ typedef struct {
void DBufInit(DynamicBuffer *dbuf);
int DBufPutcFN(DynamicBuffer *dbuf, char c);
int DBufPuts(DynamicBuffer *dbuf, char *str);
int DBufPuts(DynamicBuffer *dbuf, char const *str);
void DBufFree(DynamicBuffer *dbuf);
int DBufGets(DynamicBuffer *dbuf, FILE *fp);

View File

@@ -41,8 +41,8 @@ static int Multiply(void), Divide(void), Mod(void), Add(void),
UnMinus(void), LogNot(void),
Compare(int);
static int MakeValue (char *s, Value *v, Var *locals);
static int ParseLiteralDate (char **s, int *jul, int *tim);
static int MakeValue (char const *s, Value *v, Var *locals);
static int ParseLiteralDate (char const **s, int *jul, int *tim);
/* Binary operators - all left-associative */
@@ -132,9 +132,9 @@ static void CleanStack(void)
/* PeekChar - peek ahead to next char. */
/* */
/***************************************************************/
static char PeekChar(char **s)
static char PeekChar(char const **s)
{
char *t = *s;
char const *t = *s;
while (*t && isspace(*t)) t++;
return *t;
}
@@ -146,7 +146,7 @@ static char PeekChar(char **s)
/* Read a token. */
/* */
/***************************************************************/
static int ParseExprToken(DynamicBuffer *buf, char **in)
static int ParseExprToken(DynamicBuffer *buf, char const **in)
{
char c;
@@ -266,7 +266,7 @@ static int ParseExprToken(DynamicBuffer *buf, char **in)
/* Put the result into value pointed to by v. */
/* */
/***************************************************************/
int EvalExpr(char **e, Value *v)
int EvalExpr(char const **e, Value *v)
{
int r;
@@ -289,7 +289,7 @@ int EvalExpr(char **e, Value *v)
}
/* Evaluate - do the actual work of evaluation. */
int Evaluate(char **s, Var *locals)
int Evaluate(char const **s, Var *locals)
{
int OpBase, ValBase;
int r;
@@ -448,7 +448,7 @@ int Evaluate(char **s, Var *locals)
/* a date or the value of a symbol. */
/* */
/***************************************************************/
static int MakeValue(char *s, Value *v, Var *locals)
static int MakeValue(char const *s, Value *v, Var *locals)
{
int len;
int h, m, r;
@@ -533,7 +533,7 @@ static int MakeValue(char *s, Value *v, Var *locals)
int DoCoerce(char type, Value *v)
{
int h, d, m, y, i, k;
char *s;
char const *s;
/* Do nothing if value is already the right type */
if (type == v->type) return OK;
@@ -1154,7 +1154,7 @@ int CopyValue(Value *dest, const Value *src)
/* and tim; update s. */
/* */
/***************************************************************/
static int ParseLiteralDate(char **s, int *jul, int *tim)
static int ParseLiteralDate(char const **s, int *jul, int *tim)
{
int y, m, d;
int hour, min;

View File

@@ -618,7 +618,8 @@ static void ChgUser(char *user)
/***************************************************************/
static void InitializeVar(char *str)
{
char *varname, *expr;
char const *varname;
char const *expr;
Value val;

View File

@@ -330,7 +330,7 @@ int ParseChar(ParsePtr p, int *err, int peek)
return *(p->epos++);
}
}
free(p->etext); /* End of substituted expression */
free((void *) p->etext); /* End of substituted expression */
p->etext = NULL;
p->epos = NULL;
p->isnested = 0;
@@ -554,7 +554,7 @@ void OutputLine(FILE *fp)
/* Create a parser given a string buffer */
/* */
/***************************************************************/
void CreateParser(char *s, ParsePtr p)
void CreateParser(char const *s, ParsePtr p)
{
p->text = s;
p->pos = s;
@@ -576,7 +576,7 @@ void CreateParser(char *s, ParsePtr p)
void DestroyParser(ParsePtr p)
{
if (p->isnested && p->etext) {
free(p->etext);
free((void *) p->etext);
p->etext = NULL;
p->isnested = 0;
}

View File

@@ -18,7 +18,7 @@
#include "dynbuf.h"
int CallUserFunc (char *name, int nargs);
int CallUserFunc (char const *name, int nargs);
int DoFset (ParsePtr p);
void ProduceCalendar (void);
char *SimpleTime (int tim);
@@ -30,8 +30,8 @@ int ParseRem (ParsePtr s, Trigger *trig, TimeTrig *tim);
int TriggerReminder (ParsePtr p, Trigger *t, TimeTrig *tim, int jul);
int ShouldTriggerReminder (Trigger *t, TimeTrig *tim, int jul);
int DoSubst (ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul, int mode);
int DoSubstFromString (char *source, DynamicBuffer *dbuf, int jul, int tim);
int EvalExpr (char **e, Value *v);
int DoSubstFromString (char const *source, DynamicBuffer *dbuf, int jul, int tim);
int EvalExpr (char const **e, Value *v);
int DoCoerce (char type, Value *v);
void PrintValue (Value *v, FILE *fp);
int CopyValue (Value *dest, const Value *src);
@@ -53,11 +53,11 @@ int ParseChar (ParsePtr p, int *err, int peek);
int ParseToken (ParsePtr p, DynamicBuffer *dbuf);
int ParseIdentifier (ParsePtr p, DynamicBuffer *dbuf);
int EvaluateExpr (ParsePtr p, Value *v);
int Evaluate (char **s, Var *locals);
int Evaluate (char const **s, Var *locals);
int FnPopValStack (Value *val);
void Eprint (const char *fmt, ...);
void OutputLine (FILE *fp);
void CreateParser (char *s, ParsePtr p);
void CreateParser (char const *s, ParsePtr p);
void DestroyParser (ParsePtr p);
int PushToken (const char *tok, ParsePtr p);
long SystemTime (int realtime);
@@ -99,7 +99,7 @@ int DoUnset (Parser *p);
int DoDump (ParsePtr p);
void DumpVarTable (void);
void DestroyVars (int all);
int PreserveVar (char *name);
int PreserveVar (char const *name);
int DoPreserve (Parser *p);
int DoSatRemind (Trigger *trig, TimeTrig *tim, ParsePtr p);
int DoMsgCommand (char *cmd, char *msg);

View File

@@ -396,7 +396,7 @@ static int CalculateNextTimeUsingSched(QueuedRem *q)
/* Use LineBuffer for temp. string storage. */
int r;
Value v;
char *s;
char const *s;
int LastTime = -1;
int ThisTime;

View File

@@ -173,7 +173,7 @@ static void IssueSortBanner(int jul)
char BanExpr[64];
int y, m, d;
Value v;
char *s = BanExpr;
char const *s = BanExpr;
DynamicBuffer buf;
if (UserFuncExists("sortbanner") != 1) return;

View File

@@ -73,12 +73,12 @@ typedef struct {
typedef struct {
char isnested; /* Is it a nested expression? */
char allownested;
char *text; /* Start of text */
char *pos; /* Current position */
char *etext; /* Substituted text */
char *epos; /* Position in substituted text */
char const *text; /* Start of text */
char const *pos; /* Current position */
char const *etext; /* Substituted text */
char const *epos; /* Position in substituted text */
DynamicBuffer pushedToken; /* Pushed-back token */
char *tokenPushed; /* NULL if no pushed-back token */
char const *tokenPushed; /* NULL if no pushed-back token */
} Parser;
typedef Parser *ParsePtr; /* Pointer to parser structure */

View File

@@ -238,12 +238,12 @@ static void FSet(UserFunc *f)
/* Call a user-defined function. */
/* */
/***************************************************************/
int CallUserFunc(char *name, int nargs)
int CallUserFunc(char const *name, int nargs)
{
UserFunc *f;
int h = HashVal(name) % FUNC_HASH_SIZE;
int i;
char *s;
char const *s;
/* Search for the function */
f = FuncHash[h];

View File

@@ -383,7 +383,7 @@ void DestroyVars(int all)
/* Given the name of a variable, "preserve" it. */
/* */
/***************************************************************/
int PreserveVar(char *name)
int PreserveVar(char const *name)
{
Var *v;

View File

@@ -1,6 +1,6 @@
#!/bin/sh
echo "Unconfiguring Remind..."
echo rm -f config.cache config.log config.status src/Makefile src/config.h
rm -f config.cache config.log config.status src/Makefile src/config.h
echo rm -f config.cache config.log config.status src/Makefile src/config.h src/version.h
rm -f config.cache config.log config.status src/Makefile src/config.h src/version.h
exit 0