1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-12-22 00:56:26 -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 <errno.h>
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <unistd.h>
#include "estruct.h" #include "estruct.h"
#include "edef.h" #include "edef.h"
#include "efunc.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 *bheadp; /* Head of list of buffers */
extern BUFFER *blistp; /* Buffer for C-X C-B */ 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 window_t *wpopup(); /* Pop up window creation */
extern LINE *lalloc(); /* Allocate a line */ extern LINE *lalloc(); /* Allocate a line */
extern char sres[NBUFN]; /* current screen resolution */ 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 execproc(int f, int n);
extern int execbuf(int f, int n); extern int execbuf(int f, int n);
extern int dobuf(BUFFER *bp); extern int dobuf(BUFFER *bp);
extern int freewhile(WHBLOCK *wp); extern void freewhile(WHBLOCK *wp);
extern int execfile(int f, int n); extern int execfile(int f, int n);
extern int dofile(char *fname); extern int dofile(char *fname);
extern int cbuf(int f, int n, int bufnum); 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 backsearch(int f, int n);
extern int backhunt(int f, int n); extern int backhunt(int f, int n);
extern int mcscanner(MC *mcpatrn, int direct, int beg_or_end); 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 int eq(unsigned char bc, unsigned char pc);
extern void savematch(void); extern void savematch(void);
extern void rvstrcpy(char *rvstr, char *str); extern void rvstrcpy(char *rvstr, char *str);
@ -358,7 +358,7 @@ extern int match_pat(char *patrn);
extern int promptpattern(char *prompt); extern int promptpattern(char *prompt);
extern int get_char(void); extern int get_char(void);
extern int uneat(void); extern int uneat(void);
extern int reeat(int c); extern void reeat(int c);
/* eval.c */ /* eval.c */
extern void varinit(void); extern void varinit(void);
@ -394,3 +394,10 @@ extern void lckerror(char *errstr);
/* names.c */ /* names.c */
extern NBIND names[]; 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: case TKCMD:
return (token); return (token);
} }
return (errorm);
} }
/* /*

78
evar.h
View File

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

View File

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

View File

@ -75,6 +75,7 @@ int risearch(int f, int n)
#if PKCODE #if PKCODE
matchlen = strlen(pat); matchlen = strlen(pat);
#endif #endif
return (TRUE);
} }
/* /*
@ -106,6 +107,7 @@ int fisearch(int f, int n)
#if PKCODE #if PKCODE
matchlen = strlen(pat); matchlen = strlen(pat);
#endif #endif
return (TRUE);
} }
/* /*
@ -296,7 +298,7 @@ int checknext(char chr, char *patrn, int dir) /* Check next character in search
buffchar = '\n'; /* And say the next char is NL */ buffchar = '\n'; /* And say the next char is NL */
} else } else
buffchar = lgetc(curline, curoff++); /* Get the next char */ buffchar = lgetc(curline, curoff++); /* Get the next char */
if (status = eq(buffchar, chr)) { /* Is it what we're looking for? */ 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_dotp = curline; /* Yes, set the buffer's point */
curwp->w_doto = curoff; /* to the matched character */ curwp->w_doto = curoff; /* to the matched character */
curwp->w_flag |= WFMOVE; /* Say that we've moved */ curwp->w_flag |= WFMOVE; /* Say that we've moved */
@ -487,7 +489,7 @@ int uneat(void)
return (c); /* and return the last char */ 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 */ if (eaten_char != -1) /* If we've already been here */
return /*(NULL) */ ; /* Don't do it again */ return /*(NULL) */ ; /* Don't do it again */

View File

@ -4,6 +4,8 @@
*/ */
#include "estruct.h" #include "estruct.h"
#include "edef.h"
#include "efunc.h"
#if (FILOCK && BSD) || SVR4 #if (FILOCK && BSD) || SVR4
#include <sys/types.h> #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 direct; which way to go.
* int beg_or_end; put point at beginning or end of pattern. * 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 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 */ LINE *curline; /* current line during scan */
int curoff; /* position within current line */ int curoff; /* position within current line */
LINE *scanline; /* current line during scanning */ LINE *scanline; /* current line during scanning */

2
tcap.c
View File

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