summaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
Diffstat (limited to 'st.c')
-rw-r--r--st.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/st.c b/st.c
index 2206100942..6bcd05879b 100644
--- a/st.c
+++ b/st.c
@@ -11,18 +11,6 @@
#ifdef NOT_RUBY
#include "regint.h"
-#else
-#ifdef RUBY_PLATFORM
-#define xmalloc ruby_xmalloc
-#define xcalloc ruby_xcalloc
-#define xrealloc ruby_xrealloc
-#define xfree ruby_xfree
-
-void *xmalloc(size_t);
-void *xcalloc(size_t, size_t);
-void *xrealloc(void *, size_t);
-void xfree(void *);
-#endif
#endif
#include "st.h"
@@ -65,8 +53,8 @@ static struct st_hash_type type_strhash = {
static void rehash(st_table *);
-#define alloc(type) (type*)xmalloc((size_t)sizeof(type))
-#define Calloc(n,s) (char*)xcalloc((n),(s))
+#define alloc(type) (type*)malloc((size_t)sizeof(type))
+#define Calloc(n,s) (char*)calloc((n),(s))
#define EQUAL(table,x,y) ((x)==(y) || (*table->type->compare)((x),(y)) == 0)
@@ -214,12 +202,12 @@ st_free_table(st_table *table)
ptr = table->bins[i];
while (ptr != 0) {
next = ptr->next;
- xfree(ptr);
+ free(ptr);
ptr = next;
}
}
- xfree(table->bins);
- xfree(table);
+ free(table->bins);
+ free(table);
}
#define PTR_NOT_EQUAL(table, ptr, hash_val, key) \
@@ -328,7 +316,7 @@ rehash(register st_table *table)
ptr = next;
}
}
- xfree(table->bins);
+ free(table->bins);
table->num_bins = new_num_bins;
table->bins = new_bins;
}
@@ -350,7 +338,7 @@ st_copy(st_table *old_table)
Calloc((unsigned)num_bins, sizeof(st_table_entry*));
if (new_table->bins == 0) {
- xfree(new_table);
+ free(new_table);
return 0;
}
@@ -360,8 +348,8 @@ st_copy(st_table *old_table)
while (ptr != 0) {
entry = alloc(st_table_entry);
if (entry == 0) {
- xfree(new_table->bins);
- xfree(new_table);
+ free(new_table->bins);
+ free(new_table);
return 0;
}
*entry = *ptr;
@@ -393,7 +381,7 @@ st_delete(register st_table *table, register st_data_t *key, st_data_t *value)
table->num_entries--;
if (value != 0) *value = ptr->record;
*key = ptr->key;
- xfree(ptr);
+ free(ptr);
return 1;
}
@@ -404,7 +392,7 @@ st_delete(register st_table *table, register st_data_t *key, st_data_t *value)
table->num_entries--;
if (value != 0) *value = tmp->record;
*key = tmp->key;
- xfree(tmp);
+ free(tmp);
return 1;
}
}
@@ -494,7 +482,7 @@ st_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
last->next = ptr->next;
}
ptr = ptr->next;
- xfree(tmp);
+ free(tmp);
table->num_entries--;
}
}