4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-01 12:00:35 +08:00

Change various declarations to ANSI style to avoid problems with gcc 15

This commit is contained in:
Radek Barton 2024-12-03 16:36:45 -05:00 committed by Jeff Johnston
parent c48d58d838
commit d636b11d2e
14 changed files with 468 additions and 358 deletions

View File

@ -58,8 +58,9 @@ struct __collate_st_chain_pri __collate_chain_pri_table[TABLE_SIZE];
void __collate_err(int ex, const char *f);
int
__collate_load_tables(encoding)
char *encoding;
__collate_load_tables(
char *encoding
)
{
char buf[PATH_MAX];
FILE *fp;
@ -113,8 +114,9 @@ __collate_load_tables(encoding)
}
u_char *
__collate_substitute(s)
const u_char *s;
__collate_substitute(
const u_char *s
)
{
int dest_len, len, nlen;
int delta = strlen((const char *) s);
@ -143,9 +145,12 @@ __collate_substitute(s)
}
void
__collate_lookup(t, len, prim, sec)
const u_char *t;
int *len, *prim, *sec;
__collate_lookup(
const u_char *t,
int *len,
int *prim,
int *sec
)
{
struct __collate_st_chain_pri *p2;
@ -165,8 +170,7 @@ __collate_lookup(t, len, prim, sec)
}
u_char *
__collate_strdup(s)
u_char *s;
__collate_strdup(u_char *s)
{
u_char *t = (u_char *) strdup((const char *) s);

View File

@ -40,8 +40,10 @@
* "[a-z]"-type ranges with national characters.
*/
int __collate_range_cmp (c1, c2)
int c1, c2;
int __collate_range_cmp (
int c1,
int c2
)
{
static char s1[2], s2[2];
int ret;

View File

@ -135,12 +135,13 @@ static char *pchar(int ch);
== size_t nmatch, regmatch_t pmatch[], int eflags);
*/
static int /* 0 success, REG_NOMATCH failure */
matcher(g, string, nmatch, pmatch, eflags)
struct re_guts *g;
char *string;
size_t nmatch;
regmatch_t pmatch[];
int eflags;
matcher(
struct re_guts *g,
char *string,
size_t nmatch,
regmatch_t pmatch[],
int eflags
)
{
char *endp;
int i;
@ -346,12 +347,13 @@ int eflags;
== char *stop, sopno startst, sopno stopst);
*/
static char * /* == stop (success) always */
dissect(m, start, stop, startst, stopst)
struct match *m;
char *start;
char *stop;
sopno startst;
sopno stopst;
dissect(
struct match *m,
char *start,
char *stop,
sopno startst,
sopno stopst
)
{
int i;
sopno ss; /* start sop of current subRE */
@ -539,13 +541,14 @@ sopno stopst;
== char *stop, sopno startst, sopno stopst, sopno lev);
*/
static char * /* == stop (success) or NULL (failure) */
backref(m, start, stop, startst, stopst, lev)
struct match *m;
char *start;
char *stop;
sopno startst;
sopno stopst;
sopno lev; /* PLUS nesting level */
backref(
struct match *m,
char *start,
char *stop,
sopno startst,
sopno stopst,
sopno lev /* PLUS nesting level */
)
{
int i;
sopno ss; /* start sop of current subRE */
@ -744,12 +747,13 @@ sopno lev; /* PLUS nesting level */
== char *stop, sopno startst, sopno stopst);
*/
static char * /* where tentative match ended, or NULL */
fast(m, start, stop, startst, stopst)
struct match *m;
char *start;
char *stop;
sopno startst;
sopno stopst;
fast(
struct match *m,
char *start,
char *stop,
sopno startst,
sopno stopst
)
{
states st = m->st;
states fresh = m->fresh;
@ -835,12 +839,13 @@ sopno stopst;
== char *stop, sopno startst, sopno stopst);
*/
static char * /* where it ended */
slow(m, start, stop, startst, stopst)
struct match *m;
char *start;
char *stop;
sopno startst;
sopno stopst;
slow(
struct match *m,
char *start,
char *stop,
sopno startst,
sopno stopst
)
{
states st = m->st;
states empty = m->empty;
@ -931,13 +936,14 @@ sopno stopst;
== #define NNONCHAR (CODEMAX-CHAR_MAX)
*/
static states
step(g, start, stop, bef, ch, aft)
struct re_guts *g;
sopno start; /* start state within strip */
sopno stop; /* state after stop state within strip */
states bef; /* states reachable before */
int ch; /* character or NONCHAR code */
states aft; /* states already known reachable after */
step(
struct re_guts *g,
sopno start, /* start state within strip */
sopno stop, /* state after stop state within strip */
states bef, /* states reachable before */
int ch, /* character or NONCHAR code */
states aft /* states already known reachable after */
)
{
cset *cs;
sop s;

View File

@ -163,11 +163,12 @@ fnmatch(pattern, string, flags)
}
static int
rangematch(pattern, test, flags, newp)
const char *pattern;
char test;
int flags;
char **newp;
rangematch(
const char *pattern,
char test,
int flags,
char **newp
)
{
int negate, ok;
char c, c2;

View File

@ -303,9 +303,10 @@ int cflags;
== static void p_ere(struct parse *p, int stop);
*/
static void
p_ere(p, stop)
struct parse *p;
int stop; /* character this ERE should end at */
p_ere(
struct parse *p,
int stop /* character this ERE should end at */
)
{
char c;
sopno prevback = 0;
@ -349,8 +350,7 @@ int stop; /* character this ERE should end at */
== static void p_ere_exp(struct parse *p);
*/
static void
p_ere_exp(p)
struct parse *p;
p_ere_exp(struct parse *p)
{
char c;
sopno pos;
@ -498,8 +498,7 @@ struct parse *p;
== static void p_str(struct parse *p);
*/
static void
p_str(p)
struct parse *p;
p_str(struct parse *p)
{
(void)REQUIRE(MORE(), REG_EMPTY);
while (MORE())
@ -519,10 +518,11 @@ struct parse *p;
* The amount of lookahead needed to avoid this kludge is excessive.
*/
static void
p_bre(p, end1, end2)
struct parse *p;
int end1; /* first terminating character */
int end2; /* second terminating character */
p_bre(
struct parse *p,
int end1, /* first terminating character */
int end2 /* second terminating character */
)
{
sopno start = HERE();
int first = 1; /* first subexpression? */
@ -552,9 +552,10 @@ int end2; /* second terminating character */
== static int p_simp_re(struct parse *p, int starordinary);
*/
static int /* was the simple RE an unbackslashed $? */
p_simp_re(p, starordinary)
struct parse *p;
int starordinary; /* is a leading * an ordinary character? */
p_simp_re(
struct parse *p,
int starordinary /* is a leading * an ordinary character? */
)
{
int c;
int count;
@ -670,8 +671,7 @@ int starordinary; /* is a leading * an ordinary character? */
== static int p_count(struct parse *p);
*/
static int /* the value */
p_count(p)
struct parse *p;
p_count(struct parse *p)
{
int count = 0;
int ndigits = 0;
@ -693,8 +693,7 @@ struct parse *p;
* no set operations are done.
*/
static void
p_bracket(p)
struct parse *p;
p_bracket(struct parse *p)
{
cset *cs = allocset(p);
int invert = 0;
@ -767,9 +766,10 @@ struct parse *p;
== static void p_b_term(struct parse *p, cset *cs);
*/
static void
p_b_term(p, cs)
struct parse *p;
cset *cs;
p_b_term(
struct parse *p,
cset *cs
)
{
char c;
char start, finish;
@ -846,9 +846,10 @@ cset *cs;
== static void p_b_cclass(struct parse *p, cset *cs);
*/
static void
p_b_cclass(p, cs)
struct parse *p;
cset *cs;
p_b_cclass(
struct parse *p,
cset *cs
)
{
int c;
char *sp = p->next;
@ -942,9 +943,10 @@ cset *cs;
* This implementation is incomplete. xxx
*/
static void
p_b_eclass(p, cs)
struct parse *p;
cset *cs;
p_b_eclass(
struct parse *p,
cset *cs
)
{
char c;
@ -957,8 +959,7 @@ cset *cs;
== static char p_b_symbol(struct parse *p);
*/
static char /* value of symbol */
p_b_symbol(p)
struct parse *p;
p_b_symbol(struct parse *p)
{
char value;
@ -977,9 +978,10 @@ struct parse *p;
== static char p_b_coll_elem(struct parse *p, int endc);
*/
static char /* value of collating element */
p_b_coll_elem(p, endc)
struct parse *p;
int endc; /* name ended by endc,']' */
p_b_coll_elem(
struct parse *p,
int endc /* name ended by endc,']' */
)
{
char *sp = p->next;
struct cname *cp;
@ -1006,8 +1008,9 @@ int endc; /* name ended by endc,']' */
== static char othercase(int ch);
*/
static char /* if no counterpart, return ch */
othercase(ch)
int ch;
othercase(
int ch
)
{
ch = (uch)ch;
assert(isalpha(ch));
@ -1026,9 +1029,10 @@ int ch;
* Boy, is this implementation ever a kludge...
*/
static void
bothcases(p, ch)
struct parse *p;
int ch;
bothcases(
struct parse *p,
int ch
)
{
char *oldnext = p->next;
char *oldend = p->end;
@ -1052,9 +1056,10 @@ int ch;
== static void ordinary(struct parse *p, int ch);
*/
static void
ordinary(p, ch)
struct parse *p;
int ch;
ordinary(
struct parse *p,
int ch
)
{
cat_t *cap = p->g->categories;
@ -1074,8 +1079,9 @@ int ch;
* Boy, is this implementation ever a kludge...
*/
static void
nonnewline(p)
struct parse *p;
nonnewline(
struct parse *p
)
{
char *oldnext = p->next;
char *oldend = p->end;
@ -1098,11 +1104,12 @@ struct parse *p;
== static void repeat(struct parse *p, sopno start, int from, int to);
*/
static void
repeat(p, start, from, to)
struct parse *p;
sopno start; /* operand from here to end of strip */
int from; /* repeated from this number */
int to; /* to this number of times (maybe INFINITY) */
repeat(
struct parse *p,
sopno start, /* operand from here to end of strip */
int from, /* repeated from this number */
int to /* to this number of times (maybe INFINITY) */
)
{
sopno finish = HERE();
# define N 2
@ -1170,9 +1177,10 @@ int to; /* to this number of times (maybe INFINITY) */
== static int seterr(struct parse *p, int e);
*/
static int /* useless but makes type checking happy */
seterr(p, e)
struct parse *p;
int e;
seterr(
struct parse *p,
int e
)
{
if (p->error == 0) /* keep earliest error condition */
p->error = e;
@ -1186,8 +1194,7 @@ int e;
== static cset *allocset(struct parse *p);
*/
static cset *
allocset(p)
struct parse *p;
allocset(struct parse *p)
{
int no = p->g->ncsets++;
size_t nc;
@ -1241,9 +1248,10 @@ struct parse *p;
== static void freeset(struct parse *p, cset *cs);
*/
static void
freeset(p, cs)
struct parse *p;
cset *cs;
freeset(
struct parse *p,
cset *cs
)
{
int i;
cset *top = &p->g->sets[p->g->ncsets];
@ -1266,9 +1274,10 @@ cset *cs;
* the same value!
*/
static int /* set number */
freezeset(p, cs)
struct parse *p;
cset *cs;
freezeset(
struct parse *p,
cset *cs
)
{
short h = cs->hash;
int i;
@ -1300,9 +1309,10 @@ cset *cs;
== static int firstch(struct parse *p, cset *cs);
*/
static int /* character; there is no "none" value */
firstch(p, cs)
struct parse *p;
cset *cs;
firstch(
struct parse *p,
cset *cs
)
{
int i;
size_t css = (size_t)p->g->csetsize;
@ -1319,9 +1329,10 @@ cset *cs;
== static int nch(struct parse *p, cset *cs);
*/
static int
nch(p, cs)
struct parse *p;
cset *cs;
nch(
struct parse *p,
cset *cs
)
{
int i;
size_t css = (size_t)p->g->csetsize;
@ -1428,9 +1439,10 @@ char *cp;
* is deferred.
*/
static void
mcinvert(p, cs)
struct parse *p;
cset *cs;
mcinvert(
struct parse *p,
cset *cs
)
{
assert(cs->multis == NULL); /* xxx */
}
@ -1443,9 +1455,10 @@ cset *cs;
* is deferred.
*/
static void
mccase(p, cs)
struct parse *p;
cset *cs;
mccase(
struct parse *p,
cset *cs
)
{
assert(cs->multis == NULL); /* xxx */
}
@ -1455,9 +1468,10 @@ cset *cs;
== static int isinsets(struct re_guts *g, int c);
*/
static int /* predicate */
isinsets(g, c)
struct re_guts *g;
int c;
isinsets(
struct re_guts *g,
int c
)
{
uch *col;
int i;
@ -1475,10 +1489,11 @@ int c;
== static int samesets(struct re_guts *g, int c1, int c2);
*/
static int /* predicate */
samesets(g, c1, c2)
struct re_guts *g;
int c1;
int c2;
samesets(
struct re_guts *g,
int c1,
int c2
)
{
uch *col;
int i;
@ -1497,9 +1512,10 @@ int c2;
== static void categorize(struct parse *p, struct re_guts *g);
*/
static void
categorize(p, g)
struct parse *p;
struct re_guts *g;
categorize(
struct parse *p,
struct re_guts *g
)
{
cat_t *cats = g->categories;
int c;
@ -1525,10 +1541,11 @@ struct re_guts *g;
== static sopno dupl(struct parse *p, sopno start, sopno finish);
*/
static sopno /* start of duplicate */
dupl(p, start, finish)
struct parse *p;
sopno start; /* from here */
sopno finish; /* to this less one */
dupl(
struct parse *p,
sopno start, /* from here */
sopno finish /* to this less one */
)
{
sopno ret = HERE();
sopno len = finish - start;
@ -1553,10 +1570,11 @@ sopno finish; /* to this less one */
* some changes to the data structures. Maybe later.
*/
static void
doemit(p, op, opnd)
struct parse *p;
sop op;
size_t opnd;
doemit(
struct parse *p,
sop op,
size_t opnd
)
{
/* avoid making error situations worse */
if (p->error != 0)
@ -1579,11 +1597,12 @@ size_t opnd;
== static void doinsert(struct parse *p, sop op, size_t opnd, sopno pos);
*/
static void
doinsert(p, op, opnd, pos)
struct parse *p;
sop op;
size_t opnd;
sopno pos;
doinsert(
struct parse *p,
sop op,
size_t opnd,
sopno pos
)
{
sopno sn;
sop s;
@ -1619,10 +1638,11 @@ sopno pos;
== static void dofwd(struct parse *p, sopno pos, sop value);
*/
static void
dofwd(p, pos, value)
struct parse *p;
sopno pos;
sop value;
dofwd(
struct parse *p,
sopno pos,
sop value
)
{
/* avoid making error situations worse */
if (p->error != 0)
@ -1637,9 +1657,10 @@ sop value;
== static void enlarge(struct parse *p, sopno size);
*/
static void
enlarge(p, size)
struct parse *p;
sopno size;
enlarge(
struct parse *p,
sopno size
)
{
sop *sp;
@ -1660,9 +1681,10 @@ sopno size;
== static void stripsnug(struct parse *p, struct re_guts *g);
*/
static void
stripsnug(p, g)
struct parse *p;
struct re_guts *g;
stripsnug(
struct parse *p,
struct re_guts *g
)
{
g->nstates = p->slen;
g->strip = (sop *)realloc((char *)p->strip, p->slen * sizeof(sop));
@ -1683,9 +1705,10 @@ struct re_guts *g;
* Note that must and mlen got initialized during setup.
*/
static void
findmust(p, g)
struct parse *p;
struct re_guts *g;
findmust(
struct parse *p,
struct re_guts *g
)
{
sop *scan;
sop *start = NULL;
@ -1852,10 +1875,11 @@ struct re_guts *g;
* re paths.
*/
static int
altoffset(scan, offset, mccs)
sop *scan;
int offset;
int mccs;
altoffset(
sop *scan,
int offset,
int mccs
)
{
int largest;
int try;
@ -1932,9 +1956,10 @@ int mccs;
* the value of the character from the text that was mismatched.
*/
static void
computejumps(p, g)
struct parse *p;
struct re_guts *g;
computejumps(
struct parse *p,
struct re_guts *g
)
{
int ch;
int mindex;
@ -1978,9 +2003,10 @@ struct re_guts *g;
* the search algorithm works.
*/
static void
computematchjumps(p, g)
struct parse *p;
struct re_guts *g;
computematchjumps(
struct parse *p,
struct re_guts *g
)
{
int mindex; /* General "must" iterator */
int suffix; /* Keeps track of matching suffix */
@ -2056,9 +2082,10 @@ struct re_guts *g;
== static sopno pluscount(struct parse *p, struct re_guts *g);
*/
static sopno /* nesting depth */
pluscount(p, g)
struct parse *p;
struct re_guts *g;
pluscount(
struct parse *p,
struct re_guts *g
)
{
sop *scan;
sop s;

View File

@ -160,9 +160,10 @@ size_t errbuf_size;
== static char *regatoi(const regex_t *preg, char *localbuf);
*/
static char *
regatoi(preg, localbuf)
const regex_t *preg;
char *localbuf;
regatoi(
const regex_t *preg,
char *localbuf
)
{
struct rerr *r;

View File

@ -276,8 +276,9 @@ error0:
}
static int
hash_close(dbp)
DB *dbp;
hash_close(
DB *dbp
)
{
HTAB *hashp;
int retval;
@ -292,8 +293,9 @@ hash_close(dbp)
}
static int
hash_fd(dbp)
const DB *dbp;
hash_fd(
const DB *dbp
)
{
HTAB *hashp;
@ -310,10 +312,11 @@ hash_fd(dbp)
/************************** LOCAL CREATION ROUTINES **********************/
static HTAB *
init_hash(hashp, file, info)
HTAB *hashp;
const char *file;
const HASHINFO *info;
init_hash(
HTAB *hashp,
const char *file,
const HASHINFO *info
)
{
#ifdef __USE_INTERNAL_STAT64
struct stat64 statbuf;
@ -385,9 +388,10 @@ init_hash(hashp, file, info)
* Returns 0 on No Error
*/
static int
init_htab(hashp, nelem)
HTAB *hashp;
int nelem;
init_htab(
HTAB *hashp,
int nelem
)
{
int nbuckets, nsegs;
int l2;
@ -431,8 +435,9 @@ init_htab(hashp, nelem)
* structure, freeing all allocated space.
*/
static int
hdestroy(hashp)
HTAB *hashp;
hdestroy(
HTAB *hashp
)
{
int i, save_errno;
@ -491,9 +496,10 @@ hdestroy(hashp)
* -1 ERROR
*/
static int
hash_sync(dbp, flags)
const DB *dbp;
u_int flags;
hash_sync(
const DB *dbp,
u_int flags
)
{
HTAB *hashp;
@ -520,8 +526,9 @@ hash_sync(dbp, flags)
* -1 indicates that errno should be set
*/
static int
flush_meta(hashp)
HTAB *hashp;
flush_meta(
HTAB *hashp
)
{
HASHHDR *whdrp;
#if (BYTE_ORDER == LITTLE_ENDIAN)
@ -568,11 +575,12 @@ flush_meta(hashp)
* -1 to indicate an internal ERROR (i.e. out of memory, etc)
*/
static int
hash_get(dbp, key, data, flag)
const DB *dbp;
const DBT *key;
DBT *data;
u_int flag;
hash_get(
const DB *dbp,
const DBT *key,
DBT *data,
u_int flag
)
{
HTAB *hashp;
@ -585,11 +593,12 @@ hash_get(dbp, key, data, flag)
}
static int
hash_put(dbp, key, data, flag)
const DB *dbp;
DBT *key;
const DBT *data;
u_int flag;
hash_put(
const DB *dbp,
DBT *key,
const DBT *data,
u_int flag
)
{
HTAB *hashp;
@ -608,10 +617,11 @@ hash_put(dbp, key, data, flag)
}
static int
hash_delete(dbp, key, flag)
const DB *dbp;
const DBT *key;
u_int flag; /* Ignored */
hash_delete(
const DB *dbp,
const DBT *key,
u_int flag /* Ignored */
)
{
HTAB *hashp;
@ -631,10 +641,12 @@ hash_delete(dbp, key, flag)
* Assume that hashp has been set in wrapper routine.
*/
static int
hash_access(hashp, action, key, val)
HTAB *hashp;
ACTION action;
DBT *key, *val;
hash_access(
HTAB *hashp,
ACTION action,
DBT *key,
DBT *val
)
{
BUFHEAD *rbufp;
BUFHEAD *bufp, *save_bufp;
@ -760,10 +772,12 @@ found:
}
static int
hash_seq(dbp, key, data, flag)
const DB *dbp;
DBT *key, *data;
u_int flag;
hash_seq(
const DB *dbp,
DBT *key,
DBT *data,
u_int flag
)
{
__uint32_t bucket;
BUFHEAD *bufp;
@ -850,8 +864,9 @@ hash_seq(dbp, key, data, flag)
* -1 ==> Error
*/
extern int
__expand_table(hashp)
HTAB *hashp;
__expand_table(
HTAB *hashp
)
{
__uint32_t old_bucket, new_bucket;
int dirsize, new_segnum, spare_ndx;
@ -905,9 +920,11 @@ __expand_table(hashp)
* fails, then this routine can go away.
*/
static void *
hash_realloc(p_ptr, oldsize, newsize)
SEGMENT **p_ptr;
int oldsize, newsize;
hash_realloc(
SEGMENT **p_ptr,
int oldsize,
int newsize
)
{
void *p;
@ -921,10 +938,11 @@ hash_realloc(p_ptr, oldsize, newsize)
}
extern __uint32_t
__call_hash(hashp, k, len)
HTAB *hashp;
char *k;
int len;
__call_hash(
HTAB *hashp,
char *k,
int len
)
{
int n, bucket;
@ -941,9 +959,10 @@ __call_hash(hashp, k, len)
* Returns 0 on success
*/
static int
alloc_segs(hashp, nsegs)
HTAB *hashp;
int nsegs;
alloc_segs(
HTAB *hashp,
int nsegs
)
{
int i;
SEGMENT store;
@ -975,8 +994,10 @@ alloc_segs(hashp, nsegs)
* Hashp->hdr needs to be byteswapped.
*/
static void
swap_header_copy(srcp, destp)
HASHHDR *srcp, *destp;
swap_header_copy(
HASHHDR *srcp,
HASHHDR *destp
)
{
int i;
@ -1004,8 +1025,9 @@ swap_header_copy(srcp, destp)
}
static void
swap_header(hashp)
HTAB *hashp;
swap_header(
HTAB *hashp
)
{
HASHHDR *hdrp;
int i;

View File

@ -83,10 +83,12 @@ static int collect_data(HTAB *, BUFHEAD *, int, int);
*-1 ==> ERROR
*/
extern int
__big_insert(hashp, bufp, key, val)
HTAB *hashp;
BUFHEAD *bufp;
const DBT *key, *val;
__big_insert(
HTAB *hashp,
BUFHEAD *bufp,
const DBT *key,
const DBT *val
)
{
__uint16_t *p;
int key_size, n, val_size;
@ -183,9 +185,10 @@ __big_insert(hashp, bufp, key, val)
*-1 => ERROR
*/
extern int
__big_delete(hashp, bufp)
HTAB *hashp;
BUFHEAD *bufp;
__big_delete(
HTAB *hashp,
BUFHEAD *bufp
)
{
BUFHEAD *last_bfp, *rbufp;
__uint16_t *bp, pageno;
@ -262,12 +265,13 @@ __big_delete(hashp, bufp)
* -3 error
*/
extern int
__find_bigpair(hashp, bufp, ndx, key, size)
HTAB *hashp;
BUFHEAD *bufp;
int ndx;
char *key;
int size;
__find_bigpair(
HTAB *hashp,
BUFHEAD *bufp,
int ndx,
char *key,
int size
)
{
__uint16_t *bp;
char *p;
@ -314,9 +318,10 @@ __find_bigpair(hashp, bufp, ndx, key, size)
* bucket)
*/
extern __uint16_t
__find_last_page(hashp, bpp)
HTAB *hashp;
BUFHEAD **bpp;
__find_last_page(
HTAB *hashp,
BUFHEAD **bpp
)
{
BUFHEAD *bufp;
__uint16_t *bp, pageno;
@ -355,12 +360,13 @@ __find_last_page(hashp, bpp)
* index (index should always be 1).
*/
extern int
__big_return(hashp, bufp, ndx, val, set_current)
HTAB *hashp;
BUFHEAD *bufp;
int ndx;
DBT *val;
int set_current;
__big_return(
HTAB *hashp,
BUFHEAD *bufp,
int ndx,
DBT *val,
int set_current
)
{
BUFHEAD *save_p;
__uint16_t *bp, len, off, save_addr;
@ -446,10 +452,12 @@ __big_return(hashp, bufp, ndx, val, set_current)
* allocate a buffer and copy the data as you recurse up.
*/
static int
collect_data(hashp, bufp, len, set)
HTAB *hashp;
BUFHEAD *bufp;
int len, set;
collect_data(
HTAB *hashp,
BUFHEAD *bufp,
int len,
int set
)
{
__uint16_t *bp;
char *p;
@ -502,11 +510,13 @@ collect_data(hashp, bufp, len, set)
* Fill in the key and data for this big pair.
*/
extern int
__big_keydata(hashp, bufp, key, val, set)
HTAB *hashp;
BUFHEAD *bufp;
DBT *key, *val;
int set;
__big_keydata(
HTAB *hashp,
BUFHEAD *bufp,
DBT *key,
DBT *val,
int set
)
{
key->size = collect_key(hashp, bufp, 0, val, set);
if (key->size == -1)
@ -520,12 +530,13 @@ __big_keydata(hashp, bufp, key, val, set)
* collect the data, allocate a buffer and copy the key as you recurse up.
*/
static int
collect_key(hashp, bufp, len, val, set)
HTAB *hashp;
BUFHEAD *bufp;
int len;
DBT *val;
int set;
collect_key(
HTAB *hashp,
BUFHEAD *bufp,
int len,
DBT *val,
int set
)
{
BUFHEAD *xbp;
char *p;
@ -565,15 +576,16 @@ collect_key(hashp, bufp, len, val, set)
* -1 => error
*/
extern int
__big_split(hashp, op, np, big_keyp, addr, obucket, ret)
HTAB *hashp;
BUFHEAD *op; /* Pointer to where to put keys that go in old bucket */
BUFHEAD *np; /* Pointer to new bucket page */
__big_split(
HTAB *hashp,
BUFHEAD *op, /* Pointer to where to put keys that go in old bucket */
BUFHEAD *np, /* Pointer to new bucket page */
/* Pointer to first page containing the big key/data */
BUFHEAD *big_keyp;
int addr; /* Address of big_keyp */
__uint32_t obucket;/* Old Bucket */
SPLIT_RETURN *ret;
BUFHEAD *big_keyp,
int addr, /* Address of big_keyp */
__uint32_t obucket,/* Old Bucket */
SPLIT_RETURN *ret
)
{
BUFHEAD *tmpp;
__uint16_t *tp;

View File

@ -107,11 +107,12 @@ static BUFHEAD *newbuf(HTAB *, __uint32_t, BUFHEAD *);
* address you are seeking.
*/
extern BUFHEAD *
__get_buf(hashp, addr, prev_bp, newpage)
HTAB *hashp;
__uint32_t addr;
BUFHEAD *prev_bp;
int newpage; /* If prev_bp set, indicates a new overflow page. */
__get_buf(
HTAB *hashp,
__uint32_t addr,
BUFHEAD *prev_bp,
int newpage /* If prev_bp set, indicates a new overflow page. */
)
{
BUFHEAD *bp;
__uint32_t is_disk_mask;
@ -162,10 +163,11 @@ __get_buf(hashp, addr, prev_bp, newpage)
* If newbuf finds an error (returning NULL), it also sets errno.
*/
static BUFHEAD *
newbuf(hashp, addr, prev_bp)
HTAB *hashp;
__uint32_t addr;
BUFHEAD *prev_bp;
newbuf(
HTAB *hashp,
__uint32_t addr,
BUFHEAD *prev_bp
)
{
BUFHEAD *bp; /* The buffer we're going to use */
BUFHEAD *xbp; /* Temp pointer */
@ -292,9 +294,10 @@ newbuf(hashp, addr, prev_bp)
}
extern void
__buf_init(hashp, nbytes)
HTAB *hashp;
int nbytes;
__buf_init(
HTAB *hashp,
int nbytes
)
{
BUFHEAD *bfp;
int npages;
@ -317,9 +320,11 @@ __buf_init(hashp, nbytes)
}
extern int
__buf_free(hashp, do_free, to_disk)
HTAB *hashp;
int do_free, to_disk;
__buf_free(
HTAB *hashp,
int do_free,
int to_disk
)
{
BUFHEAD *bp;
@ -348,9 +353,10 @@ __buf_free(hashp, do_free, to_disk)
}
extern void
__reclaim_buf(hashp, bp)
HTAB *hashp;
BUFHEAD *bp;
__reclaim_buf(
HTAB *hashp,
BUFHEAD *bp
)
{
bp->ovfl = 0;
bp->addr = 0;

View File

@ -167,9 +167,10 @@ hash3(keyarg, len)
/* Hash function from Chris Torek. */
static __uint32_t
hash4(keyarg, len)
const void *keyarg;
size_t len;
hash4(
const void *keyarg,
size_t len
)
{
const u_char *key;
size_t loop;

View File

@ -40,8 +40,9 @@ static char sccsid[] = "@(#)hash_log2.c 8.2 (Berkeley) 5/31/94";
#include "db_local.h"
__uint32_t
__log2(num)
__uint32_t num;
__log2(
__uint32_t num
)
{
__uint32_t i, limit;

View File

@ -91,9 +91,11 @@ static int ugly_split
* stuff on.
*/
static void
putpair(p, key, val)
char *p;
const DBT *key, *val;
putpair(
char *p,
const DBT *key,
const DBT *val
)
{
__uint16_t *bp, n, off;
@ -123,10 +125,11 @@ putpair(p, key, val)
* -1 error
*/
extern int
__delpair(hashp, bufp, ndx)
HTAB *hashp;
BUFHEAD *bufp;
int ndx;
__delpair(
HTAB *hashp,
BUFHEAD *bufp,
int ndx
)
{
__uint16_t *bp, newoff;
int n;
@ -176,9 +179,11 @@ __delpair(hashp, bufp, ndx)
* -1 ==> Error
*/
extern int
__split_page(hashp, obucket, nbucket)
HTAB *hashp;
__uint32_t obucket, nbucket;
__split_page(
HTAB *hashp,
__uint32_t obucket,
__uint32_t nbucket
)
{
BUFHEAD *new_bufp, *old_bufp;
__uint16_t *ino;
@ -272,12 +277,14 @@ __split_page(hashp, obucket, nbucket)
* -1 ==> failure
*/
static int
ugly_split(hashp, obucket, old_bufp, new_bufp, copyto, moved)
HTAB *hashp;
__uint32_t obucket; /* Same as __split_page. */
BUFHEAD *old_bufp, *new_bufp;
int copyto; /* First byte on page which contains key/data values. */
int moved; /* Number of pairs moved to new page. */
ugly_split(
HTAB *hashp,
__uint32_t obucket, /* Same as __split_page. */
BUFHEAD *old_bufp,
BUFHEAD *new_bufp,
int copyto, /* First byte on page which contains key/data values. */
int moved /* Number of pairs moved to new page. */
)
{
BUFHEAD *bufp; /* Buffer header for ino */
__uint16_t *ino; /* Page keys come off of */
@ -393,10 +400,12 @@ ugly_split(hashp, obucket, old_bufp, new_bufp, copyto, moved)
* 1 ==> failure
*/
extern int
__addel(hashp, bufp, key, val)
HTAB *hashp;
BUFHEAD *bufp;
const DBT *key, *val;
__addel(
HTAB *hashp,
BUFHEAD *bufp,
const DBT *key,
const DBT *val
)
{
__uint16_t *bp, *sop;
int do_expand;
@ -460,9 +469,10 @@ __addel(hashp, bufp, key, val)
* NULL on error
*/
extern BUFHEAD *
__add_ovflpage(hashp, bufp)
HTAB *hashp;
BUFHEAD *bufp;
__add_ovflpage(
HTAB *hashp,
BUFHEAD *bufp
)
{
__uint16_t *sp;
__uint16_t ndx, ovfl_num;
@ -513,11 +523,14 @@ __add_ovflpage(hashp, bufp)
* -1 indicates FAILURE
*/
extern int
__get_page(hashp, p, bucket, is_bucket, is_disk, is_bitmap)
HTAB *hashp;
char *p;
__uint32_t bucket;
int is_bucket, is_disk, is_bitmap;
__get_page(
HTAB *hashp,
char *p,
__uint32_t bucket,
int is_bucket,
int is_disk,
int is_bitmap
)
{
int fd, page, size;
int rsize;
@ -573,11 +586,13 @@ __get_page(hashp, p, bucket, is_bucket, is_disk, is_bitmap)
* -1 ==>failure
*/
extern int
__put_page(hashp, p, bucket, is_bucket, is_bitmap)
HTAB *hashp;
char *p;
__uint32_t bucket;
int is_bucket, is_bitmap;
__put_page(
HTAB *hashp,
char *p,
__uint32_t bucket,
int is_bucket,
int is_bitmap
)
{
int fd, page, size;
int wsize;
@ -622,9 +637,12 @@ __put_page(hashp, p, bucket, is_bucket, is_bitmap)
* once they are read in.
*/
extern int
__ibitmap(hashp, pnum, nbits, ndx)
HTAB *hashp;
int pnum, nbits, ndx;
__ibitmap(
HTAB *hashp,
int pnum,
int nbits,
int ndx
)
{
__uint32_t *ip;
int clearbytes, clearints;
@ -645,8 +663,9 @@ __ibitmap(hashp, pnum, nbits, ndx)
}
static __uint32_t
first_free(map)
__uint32_t map;
first_free(
__uint32_t map
)
{
__uint32_t i, mask;
@ -660,8 +679,9 @@ first_free(map)
}
static __uint16_t
overflow_page(hashp)
HTAB *hashp;
overflow_page(
HTAB *hashp
)
{
__uint32_t *freep = NULL;
int max_free, offset, splitnum;
@ -808,9 +828,10 @@ found:
* Mark this overflow page as free.
*/
extern void
__free_ovflpage(hashp, obufp)
HTAB *hashp;
BUFHEAD *obufp;
__free_ovflpage(
HTAB *hashp,
BUFHEAD *obufp
)
{
__uint16_t addr;
__uint32_t *freep;
@ -854,8 +875,9 @@ __free_ovflpage(hashp, obufp)
* -1 failure
*/
static int
open_temp(hashp)
HTAB *hashp;
open_temp(
HTAB *hashp
)
{
sigset_t set, oset;
static char namestr[] = "_hashXXXXXX";
@ -878,9 +900,11 @@ open_temp(hashp)
* an overflow pair, so we need to shift things.
*/
static void
squeeze_key(sp, key, val)
__uint16_t *sp;
const DBT *key, *val;
squeeze_key(
__uint16_t *sp,
const DBT *key,
const DBT *val
)
{
char *p;
__uint16_t free_space, n, off, pageno;
@ -905,9 +929,10 @@ squeeze_key(sp, key, val)
}
static __uint32_t *
fetch_bitmap(hashp, ndx)
HTAB *hashp;
int ndx;
fetch_bitmap(
HTAB *hashp,
int ndx
)
{
if (ndx >= hashp->nmaps)
return (NULL);

View File

@ -26,9 +26,10 @@ __RCSID("$NetBSD: tdelete.c,v 1.2 1999/09/16 11:45:37 lukem Exp $");
/* Walk the nodes of a tree */
static void
trecurse(root, free_action)
node_t *root; /* Root of the tree to be walked */
void (*free_action)(void *);
trecurse(
node_t *root, /* Root of the tree to be walked */
void (*free_action)(void *)
)
{
if (root->llink != NULL)
trecurse(root->llink, free_action);

View File

@ -28,10 +28,11 @@ static void trecurse(const node_t *,
/* Walk the nodes of a tree */
static void
trecurse(root, action, level)
const node_t *root; /* Root of the tree to be walked */
void (*action)(const void *, VISIT, int);
int level;
trecurse(
const node_t *root, /* Root of the tree to be walked */
void (*action)(const void *, VISIT, int),
int level
)
{
if (root->llink == NULL && root->rlink == NULL)