diff --git a/Makefile b/Makefile index ca9c51b..d014423 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ uname_S := $(shell sh -c 'echo $(uname_S) | sed s/_.*$$//') PROGRAM=ue CC=gcc -WARNINGS=-Wall -Wstrict-prototypes +WARNINGS=-Wall -Wextra -Wstrict-prototypes -Wno-unused-parameter CFLAGS=-O2 $(WARNINGS) #CC=c89 +O3 # HP #CFLAGS= -D_HPUX_SOURCE -DSYSV @@ -87,7 +87,7 @@ lint: ${SRC} cat lintout splint: - splint $(DEFINES) $(SRC) -booltype boolean -booltrue TRUE -boolfalse FALSE +posixlib + splint -weak $(DEFINES) $(SRC) -booltype boolean -booltrue TRUE -boolfalse FALSE +posixlib errs: @rm -f makeout diff --git a/bind.c b/bind.c index 636f27c..593306d 100644 --- a/bind.c +++ b/bind.c @@ -35,7 +35,7 @@ static int strinc( char *source, char *sub) ; static void cmdstr( int c, char *seq) ; static unsigned int getckey( int mflag) ; static unsigned int stock( char *keyname) ; -static int unbindchar( int c) ; +static int unbindchar( unsigned c) ; static char *getfname( fn_t) ; @@ -233,7 +233,7 @@ int unbindkey(int f, int n) * * int c; command key to unbind */ -static int unbindchar( int c) { +static int unbindchar( unsigned c) { struct key_tab *ktp; /* pointer into the command table */ struct key_tab *sktp; /* saved pointer into the command table */ int found; /* matched command flag */ @@ -514,8 +514,7 @@ static void cmdstr( int c, char *seq) { * * int c; key to find what is bound to it */ -int (*getbind(int c))(int, int) -{ +fn_t getbind( unsigned c) { struct key_tab *ktp; ktp = &keytab[0]; /* Look in key table. */ diff --git a/bind.h b/bind.h index 7f3b0ee..7a543c1 100644 --- a/bind.h +++ b/bind.h @@ -16,7 +16,7 @@ int bindtokey( int f, int n) ; int unbindkey( int f, int n) ; int desbind( int f, int n) ; int startup( const char *fname) ; -fn_t getbind( int c) ; +fn_t getbind( unsigned keycode) ; fn_t fncmatch( char *) ; char *transbind( char *skey) ; diff --git a/ebind.h b/ebind.h index 4f129df..0b0f1d4 100644 --- a/ebind.h +++ b/ebind.h @@ -1,6 +1,6 @@ /* Structure for the table of initial key bindings. */ struct key_tab { - int k_code ; /* Key code */ + unsigned k_code ; /* Key code */ int (*k_fp)( int, int) ; /* Routine to handle it */ } ; diff --git a/eval.c b/eval.c index d149399..b5a82b0 100644 --- a/eval.c +++ b/eval.c @@ -341,7 +341,7 @@ void varinit(void) * @fname: name of function to evaluate. */ static char *gtfun( char *fname) { - int fnum ; /* index to function to eval */ + unsigned fnum ; /* index to function to eval */ char argx[ 512] ; /* last argument, fixed sized allocation */ char *arg1 ; /* value of first argument */ char *arg2 ; /* value of second argument */ @@ -627,7 +627,7 @@ static char *gtusr( char *vname) { * char *vname; name of environment variable to retrieve */ static char *gtenv( char *vname) { - int vnum; /* ordinal number of var refrenced */ + unsigned vnum ; /* ordinal number of var referenced */ /* scan the list, looking for the referenced name */ for (vnum = 0; vnum < ARRAY_SIZE(envars); vnum++) @@ -845,7 +845,7 @@ int mdbugout( char *fmt, char *s1, char *s2, char *s3) { */ static void findvar(char *var, struct variable_description *vd, int size) { - int vnum; /* subscript in variable arrays */ + unsigned vnum ; /* subscript in variable arrays */ int vtype; /* type to return */ vnum = -1; @@ -1160,7 +1160,7 @@ char *getval(char *token) { int status; /* error return */ struct buffer *bp; /* temp buffer pointer */ - int blen; /* length of buffer argument */ + unsigned blen ; /* length of buffer argument */ int distmp; /* temporary discmd flag */ static char buf[NSTRING]; /* string buffer for some returns */ diff --git a/flook.c b/flook.c index 2971edb..6bde504 100644 --- a/flook.c +++ b/flook.c @@ -76,7 +76,7 @@ boolean fexist( const char *fname) */ char *flook( const char *fname, boolean hflag) { - int i; /* index */ + unsigned i ; /* index */ static char fspec[NSTRING]; /* full path spec to search */ #if ENVFUNC diff --git a/isearch.c b/isearch.c index 4acb162..97f4339 100644 --- a/isearch.c +++ b/isearch.c @@ -185,7 +185,7 @@ static int isearch(int f, int n) { int status; /* Search status */ int col; /* prompt column */ - int cpos; /* character number in search string */ + unsigned cpos ; /* character number in search string */ int c; /* current input character */ int expc; /* function expanded input char */ spat_t pat_save ; /* Saved copy of the old pattern str */ @@ -397,7 +397,7 @@ static int scanmore(char *patrn, int dir) /* search forward or back for a patter */ static int match_pat(char *patrn) /* See if the pattern string matches string at "." */ { - int i; /* Generic loop index/offset */ + unsigned i ; /* Generic loop index/offset */ int buffchar; /* character at current position */ struct line *curline; /* current line during scan */ int curoff; /* position within current line */ diff --git a/random.c b/random.c index 58bbf91..1764282 100644 --- a/random.c +++ b/random.c @@ -940,7 +940,7 @@ int delgmode(int f, int n) * int global; true = global flag, false = current buffer flag */ static int adjustmode( int kind, int global) { - int i; /* loop index */ + unsigned i ; /* loop index */ int status; /* error return on input */ char prompt[50]; /* string to prompt user with */ char cbuf[ NSTRING] ; /* buffer to recieve mode name into */ diff --git a/search.c b/search.c index 33876da..ea170cf 100644 --- a/search.c +++ b/search.c @@ -741,7 +741,6 @@ static int readpattern(char *prompt, char *apat, int srch) void savematch(void) { char *ptr; /* pointer to last match string */ - int j; struct line *curline; /* line of last match */ int curoff; /* offset " " */ @@ -754,6 +753,8 @@ void savematch(void) ptr = patmatch = malloc(matchlen + 1); if (ptr != NULL) { + unsigned j ; + curoff = matchoff; curline = matchline;