From 680609ee1cac250bafd6da503763c712802999fe Mon Sep 17 00:00:00 2001 From: ocean Date: Mon, 12 Sep 2005 10:44:21 +0000 Subject: * array.c: moved to ANSI function style from K&R function style. (used protoize on windows, so still K&R remains on #ifdef part of other platforms. And `foo _((boo))' stuff is still there) [ruby-dev:26975] * bignum.c, class.c, compar.c, dir.c, dln.c, dmyext.c, enum.c, enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c, io.c, main.c, marshal.c, math.c, numeric.c, object.c, pack.c, prec.c, process.c, random.c, range.c, re.c, regcomp.c, regenc.c, regerror.c, regexec.c, regparse.c, regparse.h, ruby.c, signal.c, sprintf.c, st.c, string.c, struct.c, time.c, util.h, variable.c, version.c: ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@9126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- st.c | 72 ++++++++++++++++++-------------------------------------------------- 1 file changed, 19 insertions(+), 53 deletions(-) (limited to 'st.c') diff --git a/st.c b/st.c index df4eb7e3e..8e78fc76c 100644 --- a/st.c +++ b/st.c @@ -117,8 +117,7 @@ static long primes[] = { }; static int -new_size(size) - int size; +new_size(int size) { int i; @@ -155,9 +154,7 @@ stat_col() #endif st_table* -st_init_table_with_size(type, size) - struct st_hash_type *type; - int size; +st_init_table_with_size(struct st_hash_type *type, int size) { st_table *tbl; @@ -180,8 +177,7 @@ st_init_table_with_size(type, size) } st_table* -st_init_table(type) - struct st_hash_type *type; +st_init_table(struct st_hash_type *type) { return st_init_table_with_size(type, 0); } @@ -193,8 +189,7 @@ st_init_numtable(void) } st_table* -st_init_numtable_with_size(size) - int size; +st_init_numtable_with_size(int size) { return st_init_table_with_size(&type_numhash, size); } @@ -206,15 +201,13 @@ st_init_strtable(void) } st_table* -st_init_strtable_with_size(size) - int size; +st_init_strtable_with_size(int size) { return st_init_table_with_size(&type_strhash, size); } void -st_free_table(table) - st_table *table; +st_free_table(st_table *table) { register st_table_entry *ptr, *next; int i; @@ -253,10 +246,7 @@ st_free_table(table) } while (0) int -st_lookup(table, key, value) - st_table *table; - register st_data_t key; - st_data_t *value; +st_lookup(st_table *table, register st_data_t key, st_data_t *value) { unsigned int hash_val, bin_pos; register st_table_entry *ptr; @@ -292,10 +282,7 @@ do {\ } while (0) int -st_insert(table, key, value) - register st_table *table; - register st_data_t key; - st_data_t value; +st_insert(register st_table *table, register st_data_t key, st_data_t value) { unsigned int hash_val, bin_pos; register st_table_entry *ptr; @@ -314,10 +301,7 @@ st_insert(table, key, value) } void -st_add_direct(table, key, value) - st_table *table; - st_data_t key; - st_data_t value; +st_add_direct(st_table *table, st_data_t key, st_data_t value) { unsigned int hash_val, bin_pos; @@ -327,8 +311,7 @@ st_add_direct(table, key, value) } static void -rehash(table) - register st_table *table; +rehash(register st_table *table) { register st_table_entry *ptr, *next, **new_bins; int i, old_num_bins = table->num_bins, new_num_bins; @@ -353,8 +336,7 @@ rehash(table) } st_table* -st_copy(old_table) - st_table *old_table; +st_copy(st_table *old_table) { st_table *new_table; st_table_entry *ptr, *entry; @@ -394,10 +376,7 @@ st_copy(old_table) } int -st_delete(table, key, value) - register st_table *table; - register st_data_t *key; - st_data_t *value; +st_delete(register st_table *table, register st_data_t *key, st_data_t *value) { unsigned int hash_val; st_table_entry *tmp; @@ -436,11 +415,7 @@ st_delete(table, key, value) } int -st_delete_safe(table, key, value, never) - register st_table *table; - register st_data_t *key; - st_data_t *value; - st_data_t never; +st_delete_safe(register st_table *table, register st_data_t *key, st_data_t *value, st_data_t never) { unsigned int hash_val; register st_table_entry *ptr; @@ -467,17 +442,14 @@ st_delete_safe(table, key, value, never) } static int -delete_never(key, value, never) - st_data_t key, value, never; +delete_never(st_data_t key, st_data_t value, st_data_t never) { if (value == never) return ST_DELETE; return ST_CONTINUE; } void -st_cleanup_safe(table, never) - st_table *table; - st_data_t never; +st_cleanup_safe(st_table *table, st_data_t never) { int num_entries = table->num_entries; @@ -486,10 +458,7 @@ st_cleanup_safe(table, never) } int -st_foreach(table, func, arg) - st_table *table; - int (*func)(); - st_data_t arg; +st_foreach(st_table *table, int (*func) (/* ??? */), st_data_t arg) { st_table_entry *ptr, *last, *tmp; enum st_retval retval; @@ -536,8 +505,7 @@ st_foreach(table, func, arg) } static int -strhash(string) - register const char *string; +strhash(register const char *string) { register int c; @@ -575,15 +543,13 @@ strhash(string) } static int -numcmp(x, y) - long x, y; +numcmp(long x, long y) { return x != y; } static int -numhash(n) - long n; +numhash(long n) { return n; } -- cgit