Skip to content

Commit

Permalink
fix problems detected by the clang lto
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/trunk@5183 23306eb0-4c56-4727-a40e-e92c0eb68959
  • Loading branch information
lrz committed Jan 20, 2011
1 parent b064e52 commit e8a9d92
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion env.c
Expand Up @@ -662,7 +662,7 @@ env_replace(VALUE env, SEL sel, VALUE hash)
}

static int
env_update_i(VALUE key, VALUE val)
env_update_i(VALUE key, VALUE val, VALUE ctx)
{
if (key != Qundef) {
if (rb_block_given_p()) {
Expand Down
2 changes: 0 additions & 2 deletions hash.c
Expand Up @@ -78,7 +78,6 @@ rb_hash(VALUE obj)
typedef int st_foreach_func(st_data_t, st_data_t, st_data_t);

struct foreach_safe_arg {
st_table *tbl;
st_foreach_func *func;
st_data_t arg;
};
Expand All @@ -101,7 +100,6 @@ st_foreach_safe(st_table *table, int (*func)(ANYARGS), st_data_t a)
{
struct foreach_safe_arg arg;

arg.tbl = table;
arg.func = (st_foreach_func *)func;
arg.arg = a;
st_foreach(table, foreach_safe_i, (st_data_t)&arg);
Expand Down
6 changes: 5 additions & 1 deletion st.c
Expand Up @@ -631,13 +631,14 @@ st_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)

if (table->entries_packed) {
for (i = 0; i < table->num_entries; i++) {
int j;
//int j;
st_data_t key, val;
key = (st_data_t)table->bins[i*2];
val = (st_data_t)table->bins[i*2+1];
retval = (*func)(key, val, arg);
switch (retval) {
case ST_CHECK: /* check if hash is modified during iteration */
#if 0 // XXX disabled because unused and causes clang errors
for (j = 0; j < table->num_entries; j++) {
if ((st_data_t)table->bins[j*2] == key)
break;
Expand All @@ -648,6 +649,7 @@ st_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
return 1;
}
/* fall through */
#endif
case ST_CONTINUE:
break;
case ST_STOP:
Expand All @@ -669,6 +671,7 @@ st_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
retval = (*func)(ptr->key, ptr->record, arg);
switch (retval) {
case ST_CHECK: /* check if hash is modified during iteration */
#if 0 // XXX disabled because unused and causes clang errors
i = ptr->hash % table->num_bins;
for (tmp = table->bins[i]; tmp != ptr; tmp = tmp->next) {
if (!tmp) {
Expand All @@ -678,6 +681,7 @@ st_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
}
}
/* fall through */
#endif
case ST_CONTINUE:
ptr = ptr->fore;
break;
Expand Down

0 comments on commit e8a9d92

Please sign in to comment.