diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2004-12-20 11:34:27 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2004-12-20 11:34:27 +0000 |
commit | e445c3ad8a040ce5aa9ffd47e72de71f7cd3dd16 (patch) | |
tree | f321abeceffdba61fb97e64b666e8793cf6e1d4e /bin/ksh/table.c | |
parent | c6e78b160bb0e446bb146be6b8b66890b48e5b31 (diff) |
Ansification plus some minor knf. No binary change on i386 and
sparc64, binary change in lex.o on macppc due to introduction of
dopprompt() prototype. ok millert@
Diffstat (limited to 'bin/ksh/table.c')
-rw-r--r-- | bin/ksh/table.c | 53 |
1 files changed, 20 insertions, 33 deletions
diff --git a/bin/ksh/table.c b/bin/ksh/table.c index 615d17ccdaf..a27cf38c685 100644 --- a/bin/ksh/table.c +++ b/bin/ksh/table.c @@ -1,4 +1,4 @@ -/* $OpenBSD: table.c,v 1.8 2004/12/19 04:14:20 deraadt Exp $ */ +/* $OpenBSD: table.c,v 1.9 2004/12/20 11:34:26 otto Exp $ */ /* * dynamic hashed associative table for commands and variables @@ -8,13 +8,12 @@ #define INIT_TBLS 8 /* initial table size (power of 2) */ -static void texpand(struct table *tp, int nsize); -static int tnamecmp(void *p1, void *p2); +static void texpand(struct table *, int); +static int tnamecmp(void *, void *); unsigned int -hash(n) - const char * n; +hash(const char *n) { unsigned int h = 0; @@ -24,10 +23,7 @@ hash(n) } void -tinit(tp, ap, tsize) - struct table *tp; - Area *ap; - int tsize; +tinit(struct table *tp, Area *ap, int tsize) { tp->areap = ap; tp->tbls = NULL; @@ -37,9 +33,7 @@ tinit(tp, ap, tsize) } static void -texpand(tp, nsize) - struct table *tp; - int nsize; +texpand(struct table *tp, int nsize) { int i; struct tbl *tblp, **p; @@ -72,10 +66,10 @@ texpand(tp, nsize) } struct tbl * -tsearch(tp, n, h) - struct table *tp; /* table */ - const char *n; /* name to enter */ - unsigned int h; /* hash(n) */ +tsearch(struct table *tp, const char *n, unsigned int h) + /* table */ + /* name to enter */ + /* hash(n) */ { struct tbl **pp, *p; @@ -95,10 +89,10 @@ tsearch(tp, n, h) } struct tbl * -tenter(tp, n, h) - struct table *tp; /* table */ - const char *n; /* name to enter */ - unsigned int h; /* hash(n) */ +tenter(struct table *tp, const char *n, unsigned int h) + /* table */ + /* name to enter */ + /* hash(n) */ { struct tbl **pp, *p; int len; @@ -137,24 +131,20 @@ tenter(tp, n, h) } void -tdelete(p) - struct tbl *p; +tdelete(struct tbl *p) { p->flag = 0; } void -twalk(ts, tp) - struct tstate *ts; - struct table *tp; +twalk(struct tstate *ts, struct table *tp) { ts->left = tp->size; ts->next = tp->tbls; } struct tbl * -tnext(ts) - struct tstate *ts; +tnext(struct tstate *ts) { while (--ts->left >= 0) { struct tbl *p = *ts->next++; @@ -165,15 +155,13 @@ tnext(ts) } static int -tnamecmp(p1, p2) - void *p1, *p2; +tnamecmp(void *p1, void *p2) { return strcmp(((struct tbl *)p1)->name, ((struct tbl *)p2)->name); } struct tbl ** -tsort(tp) - struct table *tp; +tsort(struct table *tp) { int i; struct tbl **p, **sp, **dp; @@ -196,8 +184,7 @@ tsort(tp) void tprintinfo(struct table *tp); void -tprintinfo(tp) - struct table *tp; +tprintinfo(struct table *tp) { struct tbl *te; char *n; |