diff options
Diffstat (limited to 'src/tblcmp.c')
-rw-r--r-- | src/tblcmp.c | 59 |
1 files changed, 23 insertions, 36 deletions
diff --git a/src/tblcmp.c b/src/tblcmp.c index 0c058e6..b0dc8b3 100644 --- a/src/tblcmp.c +++ b/src/tblcmp.c @@ -36,11 +36,11 @@ /* declarations for functions that have forward references */ -void mkentry PROTO ((int *, int, int, int, int)); -void mkprot PROTO ((int[], int, int)); -void mktemplate PROTO ((int[], int, int)); -void mv2front PROTO ((int)); -int tbldiff PROTO ((int[], int, int[])); +void mkentry(int *, int, int, int, int); +void mkprot(int[], int, int); +void mktemplate(int[], int, int); +void mv2front(int); +int tbldiff(int[], int, int[]); /* bldtbl - build table entries for dfa state @@ -78,8 +78,7 @@ int tbldiff PROTO ((int[], int, int[])); * cost only one difference. */ -void bldtbl (state, statenum, totaltrans, comstate, comfreq) - int state[], statenum, totaltrans, comstate, comfreq; +void bldtbl (int state[], int statenum, int totaltrans, int comstate, int comfreq) { int extptr, extrct[2][CSIZE + 1]; int mindiff, minprot, i, d; @@ -221,7 +220,7 @@ void bldtbl (state, statenum, totaltrans, comstate, comfreq) * classes. */ -void cmptmps () +void cmptmps (void) { int tmpstorage[CSIZE + 1]; int *tmp = tmpstorage, i, j; @@ -289,7 +288,7 @@ void cmptmps () /* expand_nxt_chk - expand the next check arrays */ -void expand_nxt_chk () +void expand_nxt_chk (void) { int old_max = current_max_xpairs; @@ -300,8 +299,7 @@ void expand_nxt_chk () nxt = reallocate_integer_array (nxt, current_max_xpairs); chk = reallocate_integer_array (chk, current_max_xpairs); - zero_out ((char *) (chk + old_max), - (size_t) (MAX_XPAIRS_INCREMENT * sizeof (int))); + memset(chk + old_max, 0, MAX_XPAIRS_INCREMENT * sizeof(int)); } @@ -324,8 +322,7 @@ void expand_nxt_chk () * and an action number will be added in [-1]. */ -int find_table_space (state, numtrans) - int *state, numtrans; +int find_table_space (int *state, int numtrans) { /* Firstfree is the position of the first possible occurrence of two * consecutive unused records in the chk and nxt arrays. @@ -419,13 +416,11 @@ int find_table_space (state, numtrans) * Initializes "firstfree" to be one beyond the end of the table. Initializes * all "chk" entries to be zero. */ -void inittbl () +void inittbl (void) { int i; - zero_out ((char *) chk, - - (size_t) (current_max_xpairs * sizeof (int))); + memset(chk, 0, current_max_xpairs * sizeof(int)); tblend = 0; firstfree = tblend + 1; @@ -451,7 +446,7 @@ void inittbl () /* mkdeftbl - make the default, "jam" table entries */ -void mkdeftbl () +void mkdeftbl (void) { int i; @@ -500,9 +495,8 @@ void mkdeftbl () * state array. */ -void mkentry (state, numchars, statenum, deflink, totaltrans) - int *state; - int numchars, statenum, deflink, totaltrans; +void mkentry (int *state, int numchars, int statenum, int deflink, + int totaltrans) { int minec, maxec, i, baseaddr; int tblbase, tbllast; @@ -616,8 +610,7 @@ void mkentry (state, numchars, statenum, deflink, totaltrans) * has only one out-transition */ -void mk1tbl (state, sym, onenxt, onedef) - int state, sym, onenxt, onedef; +void mk1tbl (int state, int sym, int onenxt, int onedef) { if (firstfree < sym) firstfree = sym; @@ -642,8 +635,7 @@ void mk1tbl (state, sym, onenxt, onedef) /* mkprot - create new proto entry */ -void mkprot (state, statenum, comstate) - int state[], statenum, comstate; +void mkprot (int state[], int statenum, int comstate) { int i, slot, tblbase; @@ -680,11 +672,10 @@ void mkprot (state, statenum, comstate) * to it */ -void mktemplate (state, statenum, comstate) - int state[], statenum, comstate; +void mktemplate (int state[], int statenum, int comstate) { int i, numdiff, tmpbase, tmp[CSIZE + 1]; - Char transset[CSIZE + 1]; + unsigned char transset[CSIZE + 1]; int tsptr; ++numtemps; @@ -732,8 +723,7 @@ void mktemplate (state, statenum, comstate) /* mv2front - move proto queue element to front of queue */ -void mv2front (qelm) - int qelm; +void mv2front (int qelm) { if (firstprot != qelm) { if (qelm == lastprot) @@ -759,8 +749,7 @@ void mv2front (qelm) * Transnum is the number of out-transitions for the state. */ -void place_state (state, statenum, transnum) - int *state, statenum, transnum; +void place_state (int *state, int statenum, int transnum) { int i; int *state_ptr; @@ -802,8 +791,7 @@ void place_state (state, statenum, transnum) * no room, we process the sucker right now. */ -void stack1 (statenum, sym, nextstate, deflink) - int statenum, sym, nextstate, deflink; +void stack1 (int statenum, int sym, int nextstate, int deflink) { if (onesp >= ONE_STACK_SIZE - 1) mk1tbl (statenum, sym, nextstate, deflink); @@ -832,8 +820,7 @@ void stack1 (statenum, sym, nextstate, deflink) * number is "numecs" minus the number of "SAME_TRANS" entries in "ext". */ -int tbldiff (state, pr, ext) - int state[], pr, ext[]; +int tbldiff (int state[], int pr, int ext[]) { int i, *sp = state, *ep = ext, *protp; int numdiff = 0; |