mirror of
https://salsa.debian.org/dskoll/remind.git
synced 2026-04-16 06:18:47 +02:00
More code cleanups and const-correctness.
This commit is contained in:
@@ -28,14 +28,14 @@
|
||||
/* Data structures used by the calendar */
|
||||
typedef struct cal_entry {
|
||||
struct cal_entry *next;
|
||||
char *text;
|
||||
char *pos;
|
||||
char const *text;
|
||||
char const *pos;
|
||||
int time;
|
||||
int priority;
|
||||
char tag[TAG_LEN+1];
|
||||
char passthru[PASSTHRU_LEN+1];
|
||||
int duration;
|
||||
char *filename;
|
||||
char const *filename;
|
||||
int lineno;
|
||||
} CalEntry;
|
||||
|
||||
@@ -48,8 +48,8 @@ static void SortCol (CalEntry **col);
|
||||
static void DoCalendarOneWeek (void);
|
||||
static void DoCalendarOneMonth (void);
|
||||
static int WriteCalendarRow (void);
|
||||
static void PrintLeft (char *s, int width, char pad);
|
||||
static void PrintCentered (char *s, int width, char pad);
|
||||
static void PrintLeft (char const *s, int width, char pad);
|
||||
static void PrintCentered (char const *s, int width, char pad);
|
||||
static int WriteOneCalLine (void);
|
||||
static int WriteOneColLine (int col);
|
||||
static void GenerateCalEntries (int col);
|
||||
@@ -303,7 +303,7 @@ static int WriteCalendarRow(void)
|
||||
/* Left-justify a piece of text. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static void PrintLeft(char *s, int width, char pad)
|
||||
static void PrintLeft(char const *s, int width, char pad)
|
||||
{
|
||||
int len = strlen(s);
|
||||
printf("%s", s);
|
||||
@@ -317,7 +317,7 @@ static void PrintLeft(char *s, int width, char pad)
|
||||
/* Center a piec of text */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static void PrintCentered(char *s, int width, char pad)
|
||||
static void PrintCentered(char const *s, int width, char pad)
|
||||
{
|
||||
int len = strlen(s);
|
||||
int d = (width - len) / 2;
|
||||
@@ -367,8 +367,8 @@ static int WriteOneCalLine(void)
|
||||
static int WriteOneColLine(int col)
|
||||
{
|
||||
CalEntry *e = CalColumn[col];
|
||||
char *s;
|
||||
char *space;
|
||||
char const *s;
|
||||
char const *space;
|
||||
int numwritten = 0;
|
||||
|
||||
/* Print as many characters as possible within the column */
|
||||
@@ -380,8 +380,8 @@ static int WriteOneColLine(int col)
|
||||
if (!*s && e->next) {
|
||||
PrintLeft("", ColSpaces, ' ');
|
||||
CalColumn[col] = e->next;
|
||||
free(e->text);
|
||||
free(e->filename);
|
||||
free((char *) e->text);
|
||||
free((char *) e->filename);
|
||||
free(e);
|
||||
return 1;
|
||||
}
|
||||
@@ -420,8 +420,8 @@ static int WriteOneColLine(int col)
|
||||
/* If done, free memory if no next entry. */
|
||||
if (!*s && !e->next) {
|
||||
CalColumn[col] = e->next;
|
||||
free(e->text);
|
||||
free(e->filename);
|
||||
free((char *) e->text);
|
||||
free((char *) e->filename);
|
||||
free(e);
|
||||
} else {
|
||||
e->pos = s;
|
||||
@@ -830,8 +830,8 @@ static void WriteSimpleEntries(int col, int jul)
|
||||
printf("* ");
|
||||
}
|
||||
printf("%s\n", e->text);
|
||||
free(e->text);
|
||||
free(e->filename);
|
||||
free((char *) e->text);
|
||||
free((char *) e->filename);
|
||||
n = e->next;
|
||||
free(e);
|
||||
e = n;
|
||||
@@ -888,14 +888,14 @@ static void WriteCalDays(void)
|
||||
/* This takes into account duration */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
char *
|
||||
char const *
|
||||
CalendarTime(int tim, int duration)
|
||||
{
|
||||
static char buf[128];
|
||||
int h, min, hh;
|
||||
int h2, min2, hh2, newtim, days;
|
||||
char *ampm1;
|
||||
char *ampm2;
|
||||
char const *ampm1;
|
||||
char const *ampm2;
|
||||
char daybuf[64];
|
||||
|
||||
buf[0] = 0;
|
||||
@@ -970,7 +970,7 @@ CalendarTime(int tim, int duration)
|
||||
/* A trailing space is always added. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
char *SimpleTime(int tim)
|
||||
char const *SimpleTime(int tim)
|
||||
{
|
||||
static char buf[32];
|
||||
int h, min, hh;
|
||||
|
||||
@@ -849,7 +849,7 @@ int DoSatRemind(Trigger *trig, TimeTrig *tim, ParsePtr p)
|
||||
static int ParsePriority(ParsePtr s, Trigger *t)
|
||||
{
|
||||
int p, r;
|
||||
char *u;
|
||||
char const *u;
|
||||
DynamicBuffer buf;
|
||||
DBufInit(&buf);
|
||||
|
||||
|
||||
@@ -54,11 +54,12 @@ int DoSubst(ParsePtr p, DynamicBuffer *dbuf, Trigger *t, TimeTrig *tt, int jul,
|
||||
int d, m, y;
|
||||
int tim = tt->ttime;
|
||||
int h, min, hh, ch, cmin, chh;
|
||||
char *pm, *cpm;
|
||||
char const *pm, *cpm;
|
||||
int tdiff, adiff, mdiff, hdiff;
|
||||
char *mplu, *hplu, *when, *plu;
|
||||
char const *mplu, *hplu, *when, *plu;
|
||||
int has_quote = 0;
|
||||
char *ss, *os;
|
||||
char *ss;
|
||||
char *os;
|
||||
char s[256];
|
||||
int origLen = DBufLen(dbuf);
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ static int DBufMakeRoom(DynamicBuffer *dbuf, int n)
|
||||
}
|
||||
|
||||
/* Allocate memory */
|
||||
buf = (char *) malloc(size);
|
||||
buf = malloc(size);
|
||||
if (!buf) return E_NO_MEM;
|
||||
|
||||
/* Copy contents */
|
||||
|
||||
16
src/expr.c
16
src/expr.c
@@ -297,7 +297,7 @@ int Evaluate(char const **s, Var *locals)
|
||||
int args; /* Number of function arguments */
|
||||
Operator op, op2;
|
||||
Value va;
|
||||
char *ufname = NULL; /* Stop GCC from complaining about use of uninit var */
|
||||
char const *ufname = NULL; /* Stop GCC from complaining about use of uninit var */
|
||||
|
||||
OpBase = OpStackPtr;
|
||||
ValBase = ValStackPtr;
|
||||
@@ -339,7 +339,7 @@ int Evaluate(char const **s, Var *locals)
|
||||
if (f) r = CallFunc(f, 0);
|
||||
else {
|
||||
r = CallUserFunc(ufname, 0);
|
||||
free(ufname);
|
||||
free((char *) ufname);
|
||||
}
|
||||
if (r) return r;
|
||||
r = ParseExprToken(&ExprBuf, s); /* Guaranteed to be right paren. */
|
||||
@@ -349,12 +349,12 @@ int Evaluate(char const **s, Var *locals)
|
||||
args++;
|
||||
r = Evaluate(s, locals);
|
||||
if (r) {
|
||||
if (!f) free(ufname);
|
||||
if (!f) free((char *) ufname);
|
||||
return r;
|
||||
}
|
||||
if (*DBufValue(&ExprBuf) == ')') break;
|
||||
else if (*DBufValue(&ExprBuf) != ',') {
|
||||
if (!f) free(ufname);
|
||||
if (!f) free((char *) ufname);
|
||||
Eprint("%s: `%c'", ErrMsg[E_EXPECT_COMMA],
|
||||
*DBufValue(&ExprBuf));
|
||||
DBufFree(&ExprBuf);
|
||||
@@ -364,7 +364,7 @@ int Evaluate(char const **s, Var *locals)
|
||||
if (f) r = CallFunc(f, args);
|
||||
else {
|
||||
r = CallUserFunc(ufname, args);
|
||||
free(ufname);
|
||||
free((char *) ufname);
|
||||
}
|
||||
DBufFree(&ExprBuf);
|
||||
if (r) return r;
|
||||
@@ -456,7 +456,7 @@ static int MakeValue(char const *s, Value *v, Var *locals)
|
||||
if (*s == '\"') { /* It's a literal string "*/
|
||||
len = strlen(s)-1;
|
||||
v->type = STR_TYPE;
|
||||
v->v.str = (char *) malloc(len);
|
||||
v->v.str = malloc(len);
|
||||
if (! v->v.str) {
|
||||
v->type = ERR_TYPE;
|
||||
return E_NO_MEM;
|
||||
@@ -751,7 +751,7 @@ static int Add(void)
|
||||
return r;
|
||||
}
|
||||
v3.type = STR_TYPE;
|
||||
v3.v.str = (char *) malloc(strlen(v1.v.str) + strlen(v2.v.str) + 1);
|
||||
v3.v.str = malloc(strlen(v1.v.str) + strlen(v2.v.str) + 1);
|
||||
if (!v3.v.str) {
|
||||
DestroyValue(v1); DestroyValue(v2);
|
||||
return E_NO_MEM;
|
||||
@@ -1102,7 +1102,7 @@ Operator *FindFunc(char const *name, Operator where[], int num)
|
||||
void PrintValue (Value *v, FILE *fp)
|
||||
{
|
||||
int y, m, d;
|
||||
char *s;
|
||||
char const *s;
|
||||
|
||||
if (v->type == STR_TYPE) {
|
||||
s=v->v.str;
|
||||
|
||||
14
src/files.c
14
src/files.c
@@ -42,20 +42,20 @@
|
||||
/* Define the structures needed by the file caching system */
|
||||
typedef struct cache {
|
||||
struct cache *next;
|
||||
char *text;
|
||||
char const *text;
|
||||
int LineNo;
|
||||
} CachedLine;
|
||||
|
||||
typedef struct cheader {
|
||||
struct cheader *next;
|
||||
char *filename;
|
||||
char const *filename;
|
||||
CachedLine *cache;
|
||||
int ownedByMe;
|
||||
} CachedFile;
|
||||
|
||||
/* Define the structures needed by the INCLUDE file system */
|
||||
typedef struct {
|
||||
char *filename;
|
||||
char const *filename;
|
||||
int LineNo;
|
||||
unsigned int IfFlags;
|
||||
int NumIfs;
|
||||
@@ -235,7 +235,7 @@ static int CacheFile(char const *fname)
|
||||
int r;
|
||||
CachedFile *cf;
|
||||
CachedLine *cl;
|
||||
char *s;
|
||||
char const *s;
|
||||
|
||||
cl = NULL;
|
||||
/* Create a file header */
|
||||
@@ -349,7 +349,7 @@ int PopFile(void)
|
||||
if (fp != stdin)
|
||||
(void) fseek(fp, i->offset, 0); /* Trust that it works... */
|
||||
}
|
||||
free(i->filename);
|
||||
free((char *) i->filename);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -457,10 +457,10 @@ static void DestroyCache(CachedFile *cf)
|
||||
{
|
||||
CachedLine *cl, *cnext;
|
||||
CachedFile *temp;
|
||||
if (cf->filename) free(cf->filename);
|
||||
if (cf->filename) free((char *) cf->filename);
|
||||
cl = cf->cache;
|
||||
while (cl) {
|
||||
if (cl->text) free (cl->text);
|
||||
if (cl->text) free ((char *) cl->text);
|
||||
cnext = cl->next;
|
||||
free(cl);
|
||||
cl = cnext;
|
||||
|
||||
27
src/funcs.c
27
src/funcs.c
@@ -362,7 +362,7 @@ static int RetStrVal(char const *s)
|
||||
{
|
||||
RetVal.type = STR_TYPE;
|
||||
if (!s) {
|
||||
RetVal.v.str = (char *) malloc(1);
|
||||
RetVal.v.str = malloc(1);
|
||||
if (RetVal.v.str) *RetVal.v.str = 0;
|
||||
} else
|
||||
RetVal.v.str = StrDup(s);
|
||||
@@ -493,7 +493,7 @@ static int FDateTime(void)
|
||||
/***************************************************************/
|
||||
static int FCoerce(void)
|
||||
{
|
||||
char *s;
|
||||
char const *s;
|
||||
|
||||
if (ARG(0).type != STR_TYPE) return E_BAD_TYPE;
|
||||
s = ARG(0).v.str;
|
||||
@@ -591,7 +591,7 @@ static int FChar(void)
|
||||
if (ARG(0).v.val < -128) return E_2LOW;
|
||||
if (ARG(0).v.val > 255) return E_2HIGH;
|
||||
len = ARG(0).v.val ? 2 : 1;
|
||||
RetVal.v.str = (char *) malloc(len);
|
||||
RetVal.v.str = malloc(len);
|
||||
if (!RetVal.v.str) return E_NO_MEM;
|
||||
RetVal.type = STR_TYPE;
|
||||
*(RetVal.v.str) = ARG(0).v.val;
|
||||
@@ -599,7 +599,7 @@ static int FChar(void)
|
||||
return OK;
|
||||
}
|
||||
|
||||
RetVal.v.str = (char *) malloc(Nargs + 1);
|
||||
RetVal.v.str = malloc(Nargs + 1);
|
||||
if (!RetVal.v.str) return E_NO_MEM;
|
||||
RetVal.type = STR_TYPE;
|
||||
for (i=0; i<Nargs; i++) {
|
||||
@@ -710,7 +710,7 @@ static int FWkdaynum(void)
|
||||
|
||||
static int FWkday(void)
|
||||
{
|
||||
char *s;
|
||||
char const *s;
|
||||
|
||||
if (!HASDATE(ARG(0)) && ARG(0).type != INT_TYPE) return E_BAD_TYPE;
|
||||
if (ARG(0).type == INT_TYPE) {
|
||||
@@ -726,7 +726,7 @@ static int FWkday(void)
|
||||
|
||||
static int FMon(void)
|
||||
{
|
||||
char *s;
|
||||
char const *s;
|
||||
int y, m, d, v;
|
||||
|
||||
if (!HASDATE(ARG(0)) && ARG(0).type != INT_TYPE) return E_BAD_TYPE;
|
||||
@@ -833,7 +833,7 @@ static int FSgn(void)
|
||||
static int FOrd(void)
|
||||
{
|
||||
int t, u, v;
|
||||
char *s;
|
||||
char const *s;
|
||||
|
||||
if (ARG(0).type != INT_TYPE) return E_BAD_TYPE;
|
||||
|
||||
@@ -874,7 +874,7 @@ static int FPlural(void)
|
||||
return OK;
|
||||
}
|
||||
RetVal.type = STR_TYPE;
|
||||
RetVal.v.str = (char *) malloc(strlen(ARG(1).v.str)+2);
|
||||
RetVal.v.str = malloc(strlen(ARG(1).v.str)+2);
|
||||
if (!RetVal.v.str) {
|
||||
RetVal.type = ERR_TYPE;
|
||||
return E_NO_MEM;
|
||||
@@ -1315,7 +1315,8 @@ static int FIsomitted(void)
|
||||
/***************************************************************/
|
||||
static int FSubstr(void)
|
||||
{
|
||||
char *s, *t;
|
||||
char *s;
|
||||
char const *t;
|
||||
int start, end;
|
||||
|
||||
if (ARG(0).type != STR_TYPE || ARG(1).type != INT_TYPE) return E_BAD_TYPE;
|
||||
@@ -1349,7 +1350,7 @@ static int FSubstr(void)
|
||||
/***************************************************************/
|
||||
static int FIndex(void)
|
||||
{
|
||||
char *s;
|
||||
char const *s;
|
||||
int start;
|
||||
|
||||
if (ARG(0).type != STR_TYPE || ARG(1).type != STR_TYPE ||
|
||||
@@ -1463,7 +1464,7 @@ static int FFiledir(void)
|
||||
static int FAccess(void)
|
||||
{
|
||||
int amode;
|
||||
char *s;
|
||||
char const *s;
|
||||
|
||||
if (ARG(0).type != STR_TYPE ||
|
||||
(ARG(1).type != INT_TYPE && ARG(1).type != STR_TYPE)) return E_BAD_TYPE;
|
||||
@@ -2096,7 +2097,7 @@ static int FPsmoon(void)
|
||||
char sizebuf[30];
|
||||
char fontsizebuf[30];
|
||||
char *s = psbuff;
|
||||
char *extra = NULL;
|
||||
char const *extra = NULL;
|
||||
int size = -1;
|
||||
int fontsize = -1;
|
||||
|
||||
@@ -2366,7 +2367,7 @@ static int tz_convert(int year, int month, int day,
|
||||
int r;
|
||||
time_t t;
|
||||
struct tm *res;
|
||||
char *old_tz;
|
||||
char const *old_tz;
|
||||
|
||||
/* init tm struct */
|
||||
tm->tm_sec = 0;
|
||||
|
||||
@@ -83,7 +83,7 @@ EXTERN INIT( int LastTriggerDate, 0);
|
||||
EXTERN INIT( int LastTrigValid, 0);
|
||||
EXTERN INIT( int LastTriggerTime, 0);
|
||||
EXTERN INIT( int ShouldCache, 0);
|
||||
EXTERN char *CurLine;
|
||||
EXTERN char const *CurLine;
|
||||
EXTERN INIT( int NumTriggered, 0);
|
||||
EXTERN int ArgC;
|
||||
EXTERN char const **ArgV;
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
#define ADAR2ADARA 1
|
||||
#define ADAR2BOTH 2
|
||||
|
||||
static char *HebMonthNames[] = {
|
||||
static char const *HebMonthNames[] = {
|
||||
"Tishrey", "Heshvan", "Kislev", "Tevet", "Shvat", "Adar A", "Adar B",
|
||||
"Nisan", "Iyar", "Sivan", "Tamuz", "Av", "Elul", "Adar"};
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ while (isdigit(*(s))) { \
|
||||
static void ChgUser(char const *u);
|
||||
static void InitializeVar(char const *str);
|
||||
|
||||
static char *BadDate = "Illegal date on command line\n";
|
||||
static char const *BadDate = "Illegal date on command line\n";
|
||||
|
||||
static DynamicBuffer default_filename_buf;
|
||||
|
||||
@@ -96,7 +96,7 @@ static DynamicBuffer default_filename_buf;
|
||||
/***************************************************************/
|
||||
static char const *DefaultFilename(void)
|
||||
{
|
||||
char *s;
|
||||
char const *s;
|
||||
|
||||
DBufInit(&default_filename_buf);
|
||||
|
||||
@@ -555,7 +555,10 @@ static void ChgUser(char const *user)
|
||||
uid_t myuid;
|
||||
|
||||
struct passwd *pwent;
|
||||
static char *home, *shell, *username, *logname;
|
||||
static char *home;
|
||||
static char *shell;
|
||||
static char *username;
|
||||
static char *logname;
|
||||
|
||||
myuid = getuid();
|
||||
|
||||
|
||||
@@ -536,8 +536,8 @@ void Eprint(char const *fmt, ...)
|
||||
/***************************************************************/
|
||||
void OutputLine(FILE *fp)
|
||||
{
|
||||
register char *s = CurLine;
|
||||
register char c = 0;
|
||||
char const *s = CurLine;
|
||||
char c = 0;
|
||||
|
||||
while (*s) {
|
||||
if (*s == '\n') Putc('\\', fp);
|
||||
@@ -592,7 +592,7 @@ void DestroyParser(ParsePtr p)
|
||||
int PushToken(char const *tok, ParsePtr p)
|
||||
{
|
||||
DBufFree(&p->pushedToken);
|
||||
if (DBufPuts(&p->pushedToken, (char *) tok) != OK ||
|
||||
if (DBufPuts(&p->pushedToken, tok) != OK ||
|
||||
DBufPutc(&p->pushedToken, ' ') != OK) {
|
||||
DBufFree(&p->pushedToken);
|
||||
return E_NO_MEM;
|
||||
@@ -977,7 +977,7 @@ int DoErrMsg(ParsePtr p)
|
||||
TimeTrig tt;
|
||||
Trigger t;
|
||||
int r;
|
||||
char *s;
|
||||
char const *s;
|
||||
|
||||
DynamicBuffer buf;
|
||||
|
||||
|
||||
@@ -113,12 +113,12 @@ int PushOmitContext(ParsePtr p)
|
||||
|
||||
context->numfull = NumFullOmits;
|
||||
context->numpart = NumPartialOmits;
|
||||
context->fullsave = (int *) malloc(NumFullOmits * sizeof(int));
|
||||
context->fullsave = malloc(NumFullOmits * sizeof(int));
|
||||
if (NumFullOmits && !context->fullsave) {
|
||||
free(context);
|
||||
return E_NO_MEM;
|
||||
}
|
||||
context->partsave = (int *) malloc(NumPartialOmits * sizeof(int));
|
||||
context->partsave = malloc(NumPartialOmits * sizeof(int));
|
||||
if (NumPartialOmits && !context->partsave) {
|
||||
free(context->fullsave);
|
||||
free(context);
|
||||
|
||||
@@ -14,15 +14,15 @@
|
||||
#define STRSET(x, str) { if (x) free(x); (x) = StrDup(str); }
|
||||
|
||||
/* Define a general malloc routine for creating pointers to objects */
|
||||
#define NEW(type) ((type *) malloc(sizeof(type)))
|
||||
#define NEW(type) (malloc(sizeof(type)))
|
||||
|
||||
#include "dynbuf.h"
|
||||
|
||||
int CallUserFunc (char const *name, int nargs);
|
||||
int DoFset (ParsePtr p);
|
||||
void ProduceCalendar (void);
|
||||
char *SimpleTime (int tim);
|
||||
char *CalendarTime (int tim, int duration);
|
||||
char const *SimpleTime (int tim);
|
||||
char const *CalendarTime (int tim, int duration);
|
||||
int DoRem (ParsePtr p);
|
||||
int DoFlush (ParsePtr p);
|
||||
void DoExit (ParsePtr p);
|
||||
|
||||
@@ -40,7 +40,7 @@ typedef struct queuedrem {
|
||||
int typ;
|
||||
int RunDisabled;
|
||||
int ntrig;
|
||||
char *text;
|
||||
char const *text;
|
||||
char passthru[PASSTHRU_LEN+1];
|
||||
char sched[VAR_NAME_LEN+1];
|
||||
char tag[TAG_LEN+1];
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <stdlib.h>
|
||||
#include "rem2ps.h"
|
||||
|
||||
#define NEW(type) ((type *) malloc(sizeof(type)))
|
||||
#define NEW(type) (malloc(sizeof(type)))
|
||||
|
||||
#define SPECIAL_NORMAL 0
|
||||
#define SPECIAL_POSTSCRIPT 1
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
/* The structure of a sorted entry */
|
||||
typedef struct sortrem {
|
||||
struct sortrem *next;
|
||||
char *text;
|
||||
char const *text;
|
||||
int trigdate;
|
||||
int trigtime;
|
||||
int typ;
|
||||
@@ -154,7 +154,7 @@ void IssueSortedReminders(void)
|
||||
break;
|
||||
}
|
||||
|
||||
free(cur->text);
|
||||
free((char *) cur->text);
|
||||
free(cur);
|
||||
cur = next;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
typedef struct udf_struct {
|
||||
struct udf_struct *next;
|
||||
char name[VAR_NAME_LEN+1];
|
||||
char *text;
|
||||
char const *text;
|
||||
Var *locals;
|
||||
char IsActive;
|
||||
int nargs;
|
||||
@@ -47,7 +47,7 @@ extern Value ValStack[];
|
||||
extern int ValStackPtr;
|
||||
|
||||
static void DestroyUserFunc (UserFunc *f);
|
||||
static void FUnset (char *name);
|
||||
static void FUnset (char const *name);
|
||||
static void FSet (UserFunc *f);
|
||||
static int SetUpLocalVars (UserFunc *f);
|
||||
static void DestroyLocalVals (UserFunc *f);
|
||||
@@ -184,7 +184,7 @@ static void DestroyUserFunc(UserFunc *f)
|
||||
}
|
||||
|
||||
/* Free the function definition */
|
||||
if (f->text) free(f->text);
|
||||
if (f->text) free( (char *) f->text);
|
||||
|
||||
/* Free the data structure itself */
|
||||
free(f);
|
||||
@@ -198,7 +198,7 @@ static void DestroyUserFunc(UserFunc *f)
|
||||
/* it exists. */
|
||||
/* */
|
||||
/***************************************************************/
|
||||
static void FUnset(char *name)
|
||||
static void FUnset(char const *name)
|
||||
{
|
||||
UserFunc *cur, *prev;
|
||||
int h;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
/***************************************************************/
|
||||
char *StrnCpy(char *dest, char const *source, int n)
|
||||
{
|
||||
register char *odest = dest;
|
||||
char *odest = dest;
|
||||
|
||||
while (n-- && (*dest++ = *source++)) ;
|
||||
if (*(dest-1)) *dest = 0;
|
||||
@@ -82,8 +82,8 @@ int StrinCmp(char const *s1, char const *s2, int n)
|
||||
/***************************************************************/
|
||||
char *StrDup(char const *s)
|
||||
{
|
||||
char *ret = (char *) malloc(strlen(s)+1);
|
||||
if (!ret) return (char *) NULL;
|
||||
char *ret = malloc(strlen(s)+1);
|
||||
if (!ret) return NULL;
|
||||
strcpy(ret, s);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -440,7 +440,7 @@ int DoPreserve (Parser *p)
|
||||
|
||||
/* The structure of a system variable */
|
||||
typedef struct {
|
||||
char *name;
|
||||
char const *name;
|
||||
char modifiable;
|
||||
int type;
|
||||
void *value;
|
||||
@@ -643,7 +643,7 @@ static void DumpSysVar(char const *name, const SysVar *v)
|
||||
}
|
||||
DestroyValue(val);
|
||||
} else if (v->type == STR_TYPE) {
|
||||
char *s = *((char **)v->value);
|
||||
char const *s = *((char **)v->value);
|
||||
int y;
|
||||
Putc('"', ErrFp);
|
||||
for (y=0; y<MAX_PRT_LEN && *s; y++) {
|
||||
|
||||
Reference in New Issue
Block a user