summaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-10-19 14:12:04 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-10-19 14:12:04 +0000
commit222ee5ee461a130dff29cbaa6014526e7c2d1df5 (patch)
tree7145fac9656a81aa73ccd6a425d5d55c80ef9753 /st.c
parentd53ad837dde3b6a29cefa9e209ad2d9af26be5c9 (diff)
* rubysig.h (CHECK_INTS): prevent signal handler to run during
critical section. [ruby-core:04039] * eval.c (load_wait): need not to call rb_thread_schedule() explicitly. [ruby-core:04039] * eval.c (rb_thread_schedule): clear rb_thread_critical. [ruby-core:04039] * st.c (st_free_table): do not call free() but xfree(). [ruby-core:06205] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'st.c')
-rw-r--r--st.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/st.c b/st.c
index 69ff6ef..f83b2b7 100644
--- a/st.c
+++ b/st.c
@@ -5,14 +5,12 @@
#include "config.h"
#include "defines.h"
#include <stdio.h>
+#ifdef HAVE_STDLIB_H
#include <stdlib.h>
+#endif
#include <string.h>
#include "st.h"
-#ifdef _WIN32
-#include <malloc.h>
-#endif
-
typedef struct st_table_entry st_table_entry;
struct st_table_entry {
@@ -218,12 +216,12 @@ st_free_table(table)
ptr = table->bins[i];
while (ptr != 0) {
next = ptr->next;
- free(ptr);
+ xfree(ptr);
ptr = next;
}
}
- free(table->bins);
- free(table);
+ xfree(table->bins);
+ xfree(table);
}
#define PTR_NOT_EQUAL(table, ptr, hash_val, key) \
@@ -342,7 +340,7 @@ rehash(table)
ptr = next;
}
}
- free(table->bins);
+ xfree(table->bins);
table->num_bins = new_num_bins;
table->bins = new_bins;
}
@@ -365,7 +363,7 @@ st_copy(old_table)
Calloc((unsigned)num_bins, sizeof(st_table_entry*));
if (new_table->bins == 0) {
- free(new_table);
+ xfree(new_table);
return 0;
}
@@ -375,8 +373,8 @@ st_copy(old_table)
while (ptr != 0) {
entry = alloc(st_table_entry);
if (entry == 0) {
- free(new_table->bins);
- free(new_table);
+ xfree(new_table->bins);
+ xfree(new_table);
return 0;
}
*entry = *ptr;
@@ -411,7 +409,7 @@ st_delete(table, key, value)
table->num_entries--;
if (value != 0) *value = ptr->record;
*key = ptr->key;
- free(ptr);
+ xfree(ptr);
return 1;
}
@@ -422,7 +420,7 @@ st_delete(table, key, value)
table->num_entries--;
if (value != 0) *value = tmp->record;
*key = tmp->key;
- free(tmp);
+ xfree(tmp);
return 1;
}
}
@@ -522,7 +520,7 @@ st_foreach(table, func, arg)
last->next = ptr->next;
}
ptr = ptr->next;
- free(tmp);
+ xfree(tmp);
table->num_entries--;
}
}