Skip to content

Cleanup some st.c and hash.c code #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from
Prev Previous commit
Next Next commit
st.c : remove call to iter function with error argument cause it is n…
…ot used

It is not used in hash.c since 2005-03-04
  • Loading branch information
funny-falcon committed Mar 24, 2012
commit e8be459195242d99b8b2a370d490dfb5a20333b6
3 changes: 1 addition & 2 deletions ext/-test-/st/numhash/numhash.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ numhash_aset(VALUE self, VALUE key, VALUE data)
}

static int
numhash_i(st_data_t key, st_data_t value, st_data_t arg, int error)
numhash_i(st_data_t key, st_data_t value, st_data_t arg)
{
VALUE ret;
if (key == 0 && value == 0 && error == 1) rb_raise(rb_eRuntimeError, "numhash modified");
ret = rb_yield_values(3, (VALUE)key, (VALUE)value, (VALUE)arg);
if (ret == Qtrue) return ST_CHECK;
return ST_CONTINUE;
Expand Down
2 changes: 1 addition & 1 deletion hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ struct hash_foreach_arg {
};

static int
hash_foreach_iter(st_data_t key, st_data_t value, st_data_t argp, int err)
hash_foreach_iter(st_data_t key, st_data_t value, st_data_t argp)
{
struct hash_foreach_arg *arg = (struct hash_foreach_arg *)argp;
int status;
Expand Down
7 changes: 2 additions & 5 deletions st.c
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ st_foreach_check(st_table *table, int (*func)(ANYARGS), st_data_t arg, st_data_t
if (!table->entries_packed) {
FIND_ENTRY(table, ptr, hash, i);
if (retval == ST_CHECK) {
if (!ptr) goto deleted;
if (!ptr) return 1;
goto unpacked_continue;
}
goto unpacked;
Expand All @@ -917,7 +917,7 @@ st_foreach_check(st_table *table, int (*func)(ANYARGS), st_data_t arg, st_data_t
}
i = find_packed_index(table, hash, key);
if (i == table->real_entries) {
goto deleted;
return 1;
}
/* fall through */
case ST_CONTINUE:
Expand Down Expand Up @@ -947,9 +947,6 @@ st_foreach_check(st_table *table, int (*func)(ANYARGS), st_data_t arg, st_data_t
case ST_CHECK: /* check if hash is modified during iteration */
for (tmp = table->bins[i]; tmp != ptr; tmp = tmp->next) {
if (!tmp) {
deleted:
/* call func with error notice */
retval = (*func)(0, 0, arg, 1);
return 1;
}
}
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy