1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* st.c: use st_index_t for indexes instead of int.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-03-12 08:56:31 +00:00
parent dd41485efb
commit 7cdc73235a
2 changed files with 12 additions and 8 deletions

View file

@ -1,3 +1,7 @@
Thu Mar 12 17:56:29 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* st.c: use st_index_t for indexes instead of int.
Thu Mar 12 09:30:54 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> Thu Mar 12 09:30:54 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (RUBY_CHECK_SIZEOF): if same size type is found, no * configure.in (RUBY_CHECK_SIZEOF): if same size type is found, no

16
st.c
View file

@ -227,7 +227,7 @@ void
st_clear(st_table *table) st_clear(st_table *table)
{ {
register st_table_entry *ptr, *next; register st_table_entry *ptr, *next;
int i; st_index_t i;
if (table->entries_packed) { if (table->entries_packed) {
table->num_entries = 0; table->num_entries = 0;
@ -284,7 +284,7 @@ st_lookup(st_table *table, register st_data_t key, st_data_t *value)
register st_table_entry *ptr; register st_table_entry *ptr;
if (table->entries_packed) { if (table->entries_packed) {
int i; st_index_t i;
for (i = 0; i < table->num_entries; i++) { for (i = 0; i < table->num_entries; i++) {
if ((st_data_t)table->bins[i*2] == key) { if ((st_data_t)table->bins[i*2] == key) {
if (value !=0) *value = (st_data_t)table->bins[i*2+1]; if (value !=0) *value = (st_data_t)table->bins[i*2+1];
@ -313,7 +313,7 @@ st_get_key(st_table *table, register st_data_t key, st_data_t *result)
register st_table_entry *ptr; register st_table_entry *ptr;
if (table->entries_packed) { if (table->entries_packed) {
int i; st_index_t i;
for (i = 0; i < table->num_entries; i++) { for (i = 0; i < table->num_entries; i++) {
if ((st_data_t)table->bins[i*2] == key) { if ((st_data_t)table->bins[i*2] == key) {
if (result !=0) *result = (st_data_t)table->bins[i*2]; if (result !=0) *result = (st_data_t)table->bins[i*2];
@ -385,7 +385,7 @@ st_insert(register st_table *table, register st_data_t key, st_data_t value)
register st_table_entry *ptr; register st_table_entry *ptr;
if (table->entries_packed) { if (table->entries_packed) {
int i; st_index_t i;
for (i = 0; i < table->num_entries; i++) { for (i = 0; i < table->num_entries; i++) {
if ((st_data_t)table->bins[i*2] == key) { if ((st_data_t)table->bins[i*2] == key) {
table->bins[i*2+1] = (struct st_table_entry*)value; table->bins[i*2+1] = (struct st_table_entry*)value;
@ -536,7 +536,7 @@ st_delete(register st_table *table, register st_data_t *key, st_data_t *value)
register st_table_entry *ptr; register st_table_entry *ptr;
if (table->entries_packed) { if (table->entries_packed) {
int i; st_index_t i;
for (i = 0; i < table->num_entries; i++) { for (i = 0; i < table->num_entries; i++) {
if ((st_data_t)table->bins[i*2] == *key) { if ((st_data_t)table->bins[i*2] == *key) {
if (value != 0) *value = (st_data_t)table->bins[i*2+1]; if (value != 0) *value = (st_data_t)table->bins[i*2+1];
@ -594,7 +594,7 @@ void
st_cleanup_safe(st_table *table, st_data_t never) st_cleanup_safe(st_table *table, st_data_t never)
{ {
st_table_entry *ptr, **last, *tmp; st_table_entry *ptr, **last, *tmp;
int i; st_index_t i;
for (i = 0; i < table->num_bins; i++) { for (i = 0; i < table->num_bins; i++) {
ptr = *(last = &table->bins[i]); ptr = *(last = &table->bins[i]);
@ -616,11 +616,11 @@ st_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
{ {
st_table_entry *ptr, **last, *tmp; st_table_entry *ptr, **last, *tmp;
enum st_retval retval; enum st_retval retval;
int i; st_index_t i;
if (table->entries_packed) { if (table->entries_packed) {
for (i = 0; i < table->num_entries; i++) { for (i = 0; i < table->num_entries; i++) {
int j; st_index_t j;
st_data_t key, val; st_data_t key, val;
key = (st_data_t)table->bins[i*2]; key = (st_data_t)table->bins[i*2];
val = (st_data_t)table->bins[i*2+1]; val = (st_data_t)table->bins[i*2+1];