1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-12-21 16:46:24 -05:00

Fix more compiler warnings

Better initializers, and more proper function types.
This commit is contained in:
Linus Torvalds 2005-10-01 00:56:15 -07:00
parent 8967dfc2c6
commit 24338ae855
11 changed files with 76 additions and 63 deletions

View File

@ -11,6 +11,7 @@
#include <errno.h>
#include <stdio.h>
#include <stdarg.h>
#include <unistd.h>
#include "estruct.h"
#include "edef.h"
#include "efunc.h"

2
edef.h
View File

@ -119,7 +119,7 @@ extern window_t *wheadp; /* Head of list of windows */
extern BUFFER *bheadp; /* Head of list of buffers */
extern BUFFER *blistp; /* Buffer for C-X C-B */
extern BUFFER *bfind(); /* Lookup a buffer by name */
extern BUFFER *bfind(char *bname, int cflag, int bflag); /* Lookup a buffer by name */
extern window_t *wpopup(); /* Pop up window creation */
extern LINE *lalloc(); /* Allocate a line */
extern char sres[NBUFN]; /* current screen resolution */

13
efunc.h
View File

@ -273,7 +273,7 @@ extern int storeproc(int f, int n);
extern int execproc(int f, int n);
extern int execbuf(int f, int n);
extern int dobuf(BUFFER *bp);
extern int freewhile(WHBLOCK *wp);
extern void freewhile(WHBLOCK *wp);
extern int execfile(int f, int n);
extern int dofile(char *fname);
extern int cbuf(int f, int n, int bufnum);
@ -336,7 +336,7 @@ extern int forwhunt(int f, int n);
extern int backsearch(int f, int n);
extern int backhunt(int f, int n);
extern int mcscanner(MC *mcpatrn, int direct, int beg_or_end);
extern int scanner(unsigned char *patrn, int direct, int beg_or_end);
extern int scanner(const char *patrn, int direct, int beg_or_end);
extern int eq(unsigned char bc, unsigned char pc);
extern void savematch(void);
extern void rvstrcpy(char *rvstr, char *str);
@ -358,7 +358,7 @@ extern int match_pat(char *patrn);
extern int promptpattern(char *prompt);
extern int get_char(void);
extern int uneat(void);
extern int reeat(int c);
extern void reeat(int c);
/* eval.c */
extern void varinit(void);
@ -394,3 +394,10 @@ extern void lckerror(char *errstr);
/* names.c */
extern NBIND names[];
/* pklock.c */
extern char *dolock(char *fname);
extern char *undolock(char *fname);
/* tcap.c */
extern void spal(char *dummy);

1
eval.c
View File

@ -839,6 +839,7 @@ char *getval(char *token)
case TKCMD:
return (token);
}
return (errorm);
}
/*

78
evar.h
View File

@ -126,45 +126,45 @@ typedef struct UFUNC {
#define TRINAMIC 3
UFUNC funcs[] = {
"add", DYNAMIC, /* add two numbers together */
"sub", DYNAMIC, /* subtraction */
"tim", DYNAMIC, /* multiplication */
"div", DYNAMIC, /* division */
"mod", DYNAMIC, /* mod */
"neg", MONAMIC, /* negate */
"cat", DYNAMIC, /* concatinate string */
"lef", DYNAMIC, /* left string(string, len) */
"rig", DYNAMIC, /* right string(string, pos) */
"mid", TRINAMIC, /* mid string(string, pos, len) */
"not", MONAMIC, /* logical not */
"equ", DYNAMIC, /* logical equality check */
"les", DYNAMIC, /* logical less than */
"gre", DYNAMIC, /* logical greater than */
"seq", DYNAMIC, /* string logical equality check */
"sle", DYNAMIC, /* string logical less than */
"sgr", DYNAMIC, /* string logical greater than */
"ind", MONAMIC, /* evaluate indirect value */
"and", DYNAMIC, /* logical and */
"or", DYNAMIC, /* logical or */
"len", MONAMIC, /* string length */
"upp", MONAMIC, /* uppercase string */
"low", MONAMIC, /* lower case string */
"tru", MONAMIC, /* Truth of the universe logical test */
"asc", MONAMIC, /* char to integer conversion */
"chr", MONAMIC, /* integer to char conversion */
"gtk", NILNAMIC, /* get 1 charater */
"rnd", MONAMIC, /* get a random number */
"abs", MONAMIC, /* absolute value of a number */
"sin", DYNAMIC, /* find the index of one string in another */
"env", MONAMIC, /* retrieve a system environment var */
"bin", MONAMIC, /* loopup what function name is bound to a key */
"exi", MONAMIC, /* check if a file exists */
"fin", MONAMIC, /* look for a file on the path... */
"ban", DYNAMIC, /* bitwise and 9-10-87 jwm */
"bor", DYNAMIC, /* bitwise or 9-10-87 jwm */
"bxo", DYNAMIC, /* bitwise xor 9-10-87 jwm */
"bno", MONAMIC, /* bitwise not */
"xla", TRINAMIC, /* XLATE character string translation */
{ "add", DYNAMIC }, /* add two numbers together */
{ "sub", DYNAMIC }, /* subtraction */
{ "tim", DYNAMIC }, /* multiplication */
{ "div", DYNAMIC }, /* division */
{ "mod", DYNAMIC }, /* mod */
{ "neg", MONAMIC }, /* negate */
{ "cat", DYNAMIC }, /* concatinate string */
{ "lef", DYNAMIC }, /* left string(string, len) */
{ "rig", DYNAMIC }, /* right string(string, pos) */
{ "mid", TRINAMIC }, /* mid string(string, pos, len) */
{ "not", MONAMIC }, /* logical not */
{ "equ", DYNAMIC }, /* logical equality check */
{ "les", DYNAMIC }, /* logical less than */
{ "gre", DYNAMIC }, /* logical greater than */
{ "seq", DYNAMIC }, /* string logical equality check */
{ "sle", DYNAMIC }, /* string logical less than */
{ "sgr", DYNAMIC }, /* string logical greater than */
{ "ind", MONAMIC }, /* evaluate indirect value */
{ "and", DYNAMIC }, /* logical and */
{ "or", DYNAMIC }, /* logical or */
{ "len", MONAMIC }, /* string length */
{ "upp", MONAMIC }, /* uppercase string */
{ "low", MONAMIC }, /* lower case string */
{ "tru", MONAMIC }, /* Truth of the universe logical test */
{ "asc", MONAMIC }, /* char to integer conversion */
{ "chr", MONAMIC }, /* integer to char conversion */
{ "gtk", NILNAMIC }, /* get 1 charater */
{ "rnd", MONAMIC }, /* get a random number */
{ "abs", MONAMIC }, /* absolute value of a number */
{ "sin", DYNAMIC }, /* find the index of one string in another */
{ "env", MONAMIC }, /* retrieve a system environment var */
{ "bin", MONAMIC }, /* loopup what function name is bound to a key */
{ "exi", MONAMIC }, /* check if a file exists */
{ "fin", MONAMIC }, /* look for a file on the path... */
{ "ban", DYNAMIC }, /* bitwise and 9-10-87 jwm */
{ "bor", DYNAMIC }, /* bitwise or 9-10-87 jwm */
{ "bxo", DYNAMIC }, /* bitwise xor 9-10-87 jwm */
{ "bno", MONAMIC }, /* bitwise not */
{ "xla", TRINAMIC }, /* XLATE character string translation */
};
#define NFUNCS sizeof(funcs) / sizeof(UFUNC)

2
exec.c
View File

@ -836,7 +836,7 @@ int dobuf(BUFFER *bp)
*
* WHBLOCK *wp; head of structure to free
*/
int freewhile(WHBLOCK *wp)
void freewhile(WHBLOCK *wp)
{
if (wp == NULL)
return;

View File

@ -502,7 +502,7 @@ int f, n; /* default flag, numeric argument [unused] */
}
#endif
#else
ibmhello()
static void ibmhello(void)
{
}
#endif

View File

@ -75,6 +75,7 @@ int risearch(int f, int n)
#if PKCODE
matchlen = strlen(pat);
#endif
return (TRUE);
}
/*
@ -106,6 +107,7 @@ int fisearch(int f, int n)
#if PKCODE
matchlen = strlen(pat);
#endif
return (TRUE);
}
/*
@ -284,25 +286,25 @@ int checknext(char chr, char *patrn, int dir) /* Check next character in search
/* setup the local scan pointer to current "." */
curline = curwp->w_dotp; /* Get the current line structure */
curoff = curwp->w_doto; /* Get the offset within that line */
curline = curwp->w_dotp; /* Get the current line structure */
curoff = curwp->w_doto; /* Get the offset within that line */
if (dir > 0) { /* If searching forward */
if (curoff == llength(curline)) { /* If at end of line */
curline = lforw(curline); /* Skip to the next line */
if (dir > 0) { /* If searching forward */
if (curoff == llength(curline)) { /* If at end of line */
curline = lforw(curline); /* Skip to the next line */
if (curline == curbp->b_linep)
return (FALSE); /* Abort if at end of buffer */
curoff = 0; /* Start at the beginning of the line */
buffchar = '\n'; /* And say the next char is NL */
return (FALSE); /* Abort if at end of buffer */
curoff = 0; /* Start at the beginning of the line */
buffchar = '\n'; /* And say the next char is NL */
} else
buffchar = lgetc(curline, curoff++); /* Get the next char */
if (status = eq(buffchar, chr)) { /* Is it what we're looking for? */
curwp->w_dotp = curline; /* Yes, set the buffer's point */
curwp->w_doto = curoff; /* to the matched character */
curwp->w_flag |= WFMOVE; /* Say that we've moved */
if ((status = eq(buffchar, chr)) != 0) { /* Is it what we're looking for? */
curwp->w_dotp = curline; /* Yes, set the buffer's point */
curwp->w_doto = curoff; /* to the matched character */
curwp->w_flag |= WFMOVE; /* Say that we've moved */
}
return (status); /* And return the status */
} else /* Else, if reverse search: */
return (status); /* And return the status */
} else /* Else, if reverse search: */
return (match_pat(patrn)); /* See if we're in the right place */
}
@ -487,7 +489,7 @@ int uneat(void)
return (c); /* and return the last char */
}
int reeat(int c)
void reeat(int c)
{
if (eaten_char != -1) /* If we've already been here */
return /*(NULL) */ ; /* Don't do it again */

View File

@ -4,6 +4,8 @@
*/
#include "estruct.h"
#include "edef.h"
#include "efunc.h"
#if (FILOCK && BSD) || SVR4
#include <sys/types.h>

View File

@ -494,10 +494,10 @@ static int amatch(MC *mcptr, int direct, LINE **pcwline, int *pcwoff)
* int direct; which way to go.
* int beg_or_end; put point at beginning or end of pattern.
*/
int scanner(unsigned char *patrn, int direct, int beg_or_end)
int scanner(const char *patrn, int direct, int beg_or_end)
{
register int c; /* character at current position */
register unsigned char *patptr; /* pointer into pattern */
const char *patptr; /* pointer into pattern */
LINE *curline; /* current line during scan */
int curoff; /* position within current line */
LINE *scanline; /* current line during scanning */

2
tcap.c
View File

@ -327,7 +327,7 @@ static void tcapscrollregion(int top, int bot)
#endif
void spal(int dummy)
void spal(char *dummy)
{ /* change palette string */
/* Does nothing here */
}