Permalink
Browse files

Hoist assignment into the for loop.

  • Loading branch information...
szegedi committed Mar 24, 2011
1 parent ac27e15 commit 3920706efacee1f05a44b5a312d4989b4004a472
Showing with 1 addition and 2 deletions.
  1. +1 −2 st.c
View
3 st.c
@@ -481,14 +481,13 @@ st_foreach_map(table, map_key_func, map_value_func)
int i;
for(i = 0; i < table->num_bins; i++) {
- for(ptr = table->bins[i]; ptr != 0;) {
+ for(ptr = table->bins[i]; ptr != 0; ptr = ptr->next) {
new_key = (*map_key_func)(ptr->key);
if(new_key != ptr->key && table->type->compare(new_key, ptr->key)) {
rb_bug("Key replaced with non-equal key");
}
ptr->key = new_key;
ptr->record = (*map_value_func)(ptr->record);
- ptr = ptr->next;
}
}
}

0 comments on commit 3920706

Please sign in to comment.