summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog15
-rw-r--r--class.c8
-rw-r--r--eval.c17
-rw-r--r--gc.c6
-rw-r--r--hash.c12
-rw-r--r--marshal.c4
-rw-r--r--parse.y8
-rw-r--r--st.c63
-rw-r--r--st.h43
-rw-r--r--variable.c56
10 files changed, 131 insertions, 101 deletions
diff --git a/ChangeLog b/ChangeLog
index 45f19b8..b407ac6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+Mon Jan 6 23:36:29 2003 Akinori MUSHA <knu@iDaemons.org>
+
+ * st.h, st.c: Introduce new conventional typedef's, st_data_t,
+ st_compare_func_t, st_hash_func_t and st_each_func_t.
+
+ * st.h, st.c: Do explicit function declarations and do not rely on
+ implicit declarations. On such platforms as IA64, int argument
+ values are NOT automatically promoted to long (64bit) values, so
+ explicit declarations are mandatory for those functions that
+ take long values or pointers. This fixes miniruby's coredump on
+ FreeBSD/IA64.
+
+ * class.c, eval.c, gc.c, hash.c, marshal.c, parse.y, variable.c:
+ Add proper casts to avoid warnings.
+
Mon Jan 6 20:44:43 2003 Akinori MUSHA <knu@iDaemons.org>
* intern.h (rb_check_array_type): Declare rb_check_array_type().
diff --git a/class.c b/class.c
index a18cdbc..50f6165 100644
--- a/class.c
+++ b/class.c
@@ -54,7 +54,7 @@ clone_method(mid, body, tbl)
NODE *body;
st_table *tbl;
{
- st_insert(tbl, mid, NEW_METHOD(body->nd_body, body->nd_noex));
+ st_insert(tbl, mid, (st_data_t)NEW_METHOD(body->nd_body, body->nd_noex));
return ST_CONTINUE;
}
@@ -77,7 +77,8 @@ rb_mod_clone(module)
}
if (RCLASS(module)->m_tbl) {
RCLASS(clone)->m_tbl = st_init_numtable();
- st_foreach(RCLASS(module)->m_tbl, clone_method, RCLASS(clone)->m_tbl);
+ st_foreach(RCLASS(module)->m_tbl, clone_method,
+ (st_data_t)RCLASS(clone)->m_tbl);
}
return (VALUE)clone;
@@ -120,7 +121,8 @@ rb_singleton_class_clone(obj)
clone->iv_tbl = st_copy(RCLASS(klass)->iv_tbl);
}
clone->m_tbl = st_init_numtable();
- st_foreach(RCLASS(klass)->m_tbl, clone_method, clone->m_tbl);
+ st_foreach(RCLASS(klass)->m_tbl, clone_method,
+ (st_data_t)clone->m_tbl);
rb_singleton_class_attached(RBASIC(clone)->klass, (VALUE)clone);
FL_SET(clone, FL_SINGLETON);
return (VALUE)clone;
diff --git a/eval.c b/eval.c
index fcf3643..955b644 100644
--- a/eval.c
+++ b/eval.c
@@ -261,7 +261,7 @@ rb_add_method(klass, mid, node, noex)
if (OBJ_FROZEN(klass)) rb_error_frozen("class/module");
rb_clear_cache_by_id(mid);
body = NEW_METHOD(node, noex);
- st_insert(RCLASS(klass)->m_tbl, mid, body);
+ st_insert(RCLASS(klass)->m_tbl, mid, (st_data_t)body);
}
void
@@ -290,7 +290,7 @@ search_method(klass, id, origin)
NODE *body;
if (!klass) return 0;
- while (!st_lookup(RCLASS(klass)->m_tbl, id, &body)) {
+ while (!st_lookup(RCLASS(klass)->m_tbl, id, (st_data_t *)&body)) {
klass = RCLASS(klass)->super;
if (!klass) return 0;
}
@@ -363,7 +363,8 @@ remove_method(klass, mid)
if (mid == __id__ || mid == __send__ || mid == init) {
rb_warn("removing `%s' may cause serious problem", rb_id2name(mid));
}
- if (!st_delete(RCLASS(klass)->m_tbl, &mid, &body) || !body->nd_body) {
+ if (!st_delete(RCLASS(klass)->m_tbl, &mid, (st_data_t *)&body) ||
+ !body->nd_body) {
rb_name_error(mid, "method `%s' not defined in %s",
rb_id2name(mid), rb_class2name(klass));
}
@@ -1746,7 +1747,7 @@ rb_alias(klass, name, def)
rb_clear_cache_by_id(name);
st_insert(RCLASS(klass)->m_tbl, name,
- NEW_METHOD(NEW_FBODY(body, def, origin), orig->nd_noex));
+ (st_data_t)NEW_METHOD(NEW_FBODY(body, def, origin), orig->nd_noex));
if (singleton) {
rb_funcall(singleton, singleton_added, 1, ID2SYM(name));
}
@@ -3249,7 +3250,7 @@ rb_eval(self, n)
if (OBJ_FROZEN(recv)) rb_error_frozen("object");
klass = rb_singleton_class(recv);
- if (st_lookup(RCLASS(klass)->m_tbl, node->nd_mid, &body)) {
+ if (st_lookup(RCLASS(klass)->m_tbl, node->nd_mid, (st_data_t *)&body)) {
if (ruby_safe_level >= 4) {
rb_raise(rb_eSecurityError, "redefining method prohibited");
}
@@ -5526,7 +5527,7 @@ rb_feature_p(feature, wait)
if (ext && strcmp(ext, ".rb") == 0) {
rb_thread_t th;
- while (st_lookup(loading_tbl, f, &th)) {
+ while (st_lookup(loading_tbl, (st_data_t)f, (st_data_t *)&th)) {
if (th == curr_thread) {
return Qtrue;
}
@@ -5692,14 +5693,14 @@ rb_f_require(obj, fname)
}
/* partial state */
ftptr = ruby_strdup(RSTRING(feature)->ptr);
- st_insert(loading_tbl, ftptr, curr_thread);
+ st_insert(loading_tbl, (st_data_t)ftptr, (st_data_t)curr_thread);
PUSH_TAG(PROT_NONE);
if ((state = EXEC_TAG()) == 0) {
rb_load(fname, 0);
}
POP_TAG();
- st_delete(loading_tbl, &ftptr, 0); /* loading done */
+ st_delete(loading_tbl, (st_data_t *)&ftptr, 0); /* loading done */
free(ftptr);
ruby_safe_level = safe;
if (state) JUMP_TAG(state);
diff --git a/gc.c b/gc.c
index e47d943..c86d248 100644
--- a/gc.c
+++ b/gc.c
@@ -428,12 +428,12 @@ rb_source_filename(f)
{
char *name;
- if (!st_lookup(source_filenames, f, &name)) {
+ if (!st_lookup(source_filenames, (st_data_t)f, (st_data_t *)&name)) {
long len = strlen(f) + 1;
char *ptr = name = ALLOC_N(char, len + 1);
*ptr++ = 0;
MEMCPY(ptr, f, char, len);
- st_add_direct(source_filenames, ptr, name);
+ st_add_direct(source_filenames, (st_data_t)ptr, (st_data_t)name);
return ptr;
}
return name + 1;
@@ -448,7 +448,7 @@ mark_source_filename(f)
}
}
-static enum st_retval
+static int
sweep_source_filename(key, value)
char *key, *value;
{
diff --git a/hash.c b/hash.c
index f2014a4..44765b7 100644
--- a/hash.c
+++ b/hash.c
@@ -144,7 +144,7 @@ static VALUE
rb_hash_foreach_call(arg)
struct rb_hash_foreach_arg *arg;
{
- st_foreach(RHASH(arg->hash)->tbl, rb_hash_foreach_iter, arg);
+ st_foreach(RHASH(arg->hash)->tbl, rb_hash_foreach_iter, (st_data_t)arg);
return Qnil;
}
@@ -276,7 +276,7 @@ rb_hash_rehash(hash)
rb_hash_modify(hash);
tbl = st_init_table_with_size(&objhash, RHASH(hash)->tbl->num_entries);
- st_foreach(RHASH(hash)->tbl, rb_hash_rehash_i, tbl);
+ st_foreach(RHASH(hash)->tbl, rb_hash_rehash_i, (st_data_t)tbl);
st_free_table(RHASH(hash)->tbl);
RHASH(hash)->tbl = tbl;
@@ -377,7 +377,7 @@ rb_hash_index(hash, value)
args[0] = value;
args[1] = Qnil;
- st_foreach(RHASH(hash)->tbl, index_i, args);
+ st_foreach(RHASH(hash)->tbl, index_i, (st_data_t)args);
return args[1];
}
@@ -449,7 +449,7 @@ rb_hash_shift(hash)
rb_hash_modify(hash);
var.stop = 0;
- st_foreach(RHASH(hash)->tbl, shift_i, &var);
+ st_foreach(RHASH(hash)->tbl, shift_i, (st_data_t)&var);
if (var.stop) {
return rb_assoc_new(var.key, var.val);
@@ -834,7 +834,7 @@ rb_hash_has_value(hash, val)
data[0] = Qfalse;
data[1] = val;
- st_foreach(RHASH(hash)->tbl, rb_hash_search_value, data);
+ st_foreach(RHASH(hash)->tbl, rb_hash_search_value, (st_data_t)data);
return data[0];
}
@@ -878,7 +878,7 @@ rb_hash_equal(hash1, hash2)
data.tbl = RHASH(hash2)->tbl;
data.result = Qtrue;
- st_foreach(RHASH(hash1)->tbl, equal_i, &data);
+ st_foreach(RHASH(hash1)->tbl, equal_i, (st_data_t)&data);
return data.result;
}
diff --git a/marshal.c b/marshal.c
index e90879a..1ea320f 100644
--- a/marshal.c
+++ b/marshal.c
@@ -324,7 +324,7 @@ w_ivar(tbl, arg)
{
if (tbl) {
w_long(tbl->num_entries, arg->arg);
- st_foreach(tbl, obj_each, arg);
+ st_foreach(tbl, obj_each, (st_data_t)arg);
}
else {
w_long(0, arg->arg);
@@ -505,7 +505,7 @@ w_object(obj, arg, limit)
w_byte(TYPE_HASH_DEF, arg);
}
w_long(RHASH(obj)->tbl->num_entries, arg);
- st_foreach(RHASH(obj)->tbl, hash_each, &c_arg);
+ st_foreach(RHASH(obj)->tbl, hash_each, (st_data_t)&c_arg);
if (!NIL_P(RHASH(obj)->ifnone)) {
w_object(RHASH(obj)->ifnone, arg, limit);
}
diff --git a/parse.y b/parse.y
index b2a835e..9e1b5b5 100644
--- a/parse.y
+++ b/parse.y
@@ -5585,7 +5585,7 @@ rb_intern(name)
ID id;
int last;
- if (st_lookup(sym_tbl, name, &id))
+ if (st_lookup(sym_tbl, (st_data_t)name, (st_data_t *)&id))
return id;
id = 0;
@@ -5648,8 +5648,8 @@ rb_intern(name)
id |= ++last_id << ID_SCOPE_SHIFT;
id_regist:
name = strdup(name);
- st_add_direct(sym_tbl, name, id);
- st_add_direct(sym_rev_tbl, id, name);
+ st_add_direct(sym_tbl, (st_data_t)name, id);
+ st_add_direct(sym_rev_tbl, id, (st_data_t)name);
return id;
}
@@ -5668,7 +5668,7 @@ rb_id2name(id)
}
}
- if (st_lookup(sym_rev_tbl, id, &name))
+ if (st_lookup(sym_rev_tbl, id, (st_data_t *)&name))
return name;
if (is_attrset_id(id)) {
diff --git a/st.c b/st.c
index 85391ca..d9e8be4 100644
--- a/st.c
+++ b/st.c
@@ -5,6 +5,7 @@
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include "st.h"
#ifdef _WIN32
@@ -15,8 +16,8 @@ typedef struct st_table_entry st_table_entry;
struct st_table_entry {
unsigned int hash;
- char *key;
- char *record;
+ st_data_t key;
+ st_data_t record;
st_table_entry *next;
};
@@ -32,18 +33,18 @@ struct st_table_entry {
* allocated initially
*
*/
-static int numcmp();
-static int numhash();
+static int numcmp(long, long);
+static int numhash(long);
static struct st_hash_type type_numhash = {
numcmp,
numhash,
};
-extern int strcmp();
-static int strhash();
+/* extern int strcmp(const char *, const char *); */
+static int strhash(const char *);
static struct st_hash_type type_strhash = {
- strcmp,
- strhash,
+ (st_compare_func_t)strcmp,
+ (st_hash_func_t)strhash,
};
#ifdef RUBY_PLATFORM
@@ -52,13 +53,13 @@ static struct st_hash_type type_strhash = {
#define xrealloc ruby_xrealloc
#define xfree ruby_xfree
-void *xmalloc();
-void *xcalloc();
-void *xrealloc();
-void xfree();
+void *xmalloc(long);
+void *xcalloc(long, long);
+void *xrealloc(void *, long);
+void xfree(void *);
#endif
-static void rehash();
+static void rehash(st_table *);
#define alloc(type) (type*)xmalloc((unsigned)sizeof(type))
#define Calloc(n,s) (char*)xcalloc((n),(s))
@@ -180,7 +181,7 @@ st_init_table(type)
}
st_table*
-st_init_numtable()
+st_init_numtable(void)
{
return st_init_table(&type_numhash);
}
@@ -193,7 +194,7 @@ st_init_numtable_with_size(size)
}
st_table*
-st_init_strtable()
+st_init_strtable(void)
{
return st_init_table(&type_strhash);
}
@@ -248,8 +249,8 @@ st_free_table(table)
int
st_lookup(table, key, value)
st_table *table;
- register char *key;
- char **value;
+ register st_data_t key;
+ st_data_t *value;
{
unsigned int hash_val, bin_pos;
register st_table_entry *ptr;
@@ -287,8 +288,8 @@ do {\
int
st_insert(table, key, value)
register st_table *table;
- register char *key;
- char *value;
+ register st_data_t key;
+ st_data_t value;
{
unsigned int hash_val, bin_pos;
register st_table_entry *ptr;
@@ -309,8 +310,8 @@ st_insert(table, key, value)
void
st_add_direct(table, key, value)
st_table *table;
- char *key;
- char *value;
+ st_data_t key;
+ st_data_t value;
{
unsigned int hash_val, bin_pos;
@@ -389,8 +390,8 @@ st_copy(old_table)
int
st_delete(table, key, value)
register st_table *table;
- register char **key;
- char **value;
+ register st_data_t *key;
+ st_data_t *value;
{
unsigned int hash_val;
st_table_entry *tmp;
@@ -431,9 +432,9 @@ st_delete(table, key, value)
int
st_delete_safe(table, key, value, never)
register st_table *table;
- register char **key;
- char **value;
- char *never;
+ register st_data_t *key;
+ st_data_t *value;
+ st_data_t never;
{
unsigned int hash_val;
register st_table_entry *ptr;
@@ -461,7 +462,7 @@ st_delete_safe(table, key, value, never)
static int
delete_never(key, value, never)
- char *key, *value, *never;
+ st_data_t key, value, never;
{
if (value == never) return ST_DELETE;
return ST_CONTINUE;
@@ -470,7 +471,7 @@ delete_never(key, value, never)
void
st_cleanup_safe(table, never)
st_table *table;
- char *never;
+ st_data_t never;
{
int num_entries = table->num_entries;
@@ -481,8 +482,8 @@ st_cleanup_safe(table, never)
void
st_foreach(table, func, arg)
st_table *table;
- enum st_retval (*func)();
- char *arg;
+ st_each_func_t func;
+ st_data_t arg;
{
st_table_entry *ptr, *last, *tmp;
enum st_retval retval;
@@ -517,7 +518,7 @@ st_foreach(table, func, arg)
static int
strhash(string)
- register char *string;
+ register const char *string;
{
register int c;
diff --git a/st.h b/st.h
index 6397f87..223f4f6 100644
--- a/st.h
+++ b/st.h
@@ -6,11 +6,17 @@
#define ST_INCLUDED
+typedef long st_data_t;
+
+typedef int (*st_compare_func_t)(st_data_t data1, st_data_t data2);
+typedef int (*st_hash_func_t)(st_data_t data);
+typedef int (*st_each_func_t)(st_data_t key, st_data_t value, st_data_t data);
+
typedef struct st_table st_table;
struct st_hash_type {
- int (*compare)();
- int (*hash)();
+ st_compare_func_t compare;
+ st_hash_func_t hash;
};
struct st_table {
@@ -20,23 +26,28 @@ struct st_table {
struct st_table_entry **bins;
};
-#define st_is_member(table,key) st_lookup(table,key,(char **)0)
+#define st_is_member(table,key) st_lookup(table,key,(st_data_t *)0)
enum st_retval {ST_CONTINUE, ST_STOP, ST_DELETE};
-st_table *st_init_table();
-st_table *st_init_table_with_size();
-st_table *st_init_numtable();
-st_table *st_init_numtable_with_size();
-st_table *st_init_strtable();
-st_table *st_init_strtable_with_size();
-int st_delete(), st_delete_safe();
-int st_insert(), st_lookup();
-void st_foreach(), st_add_direct(), st_free_table(), st_cleanup_safe();
-st_table *st_copy();
-
-#define ST_NUMCMP ((int (*)()) 0)
-#define ST_NUMHASH ((int (*)()) -2)
+st_table *st_init_table(struct st_hash_type *);
+st_table *st_init_table_with_size(struct st_hash_type *, int);
+st_table *st_init_numtable(void);
+st_table *st_init_numtable_with_size(int);
+st_table *st_init_strtable(void);
+st_table *st_init_strtable_with_size(int);
+int st_delete(st_table *, st_data_t *, st_data_t *);
+int st_delete_safe(st_table *, st_data_t *, st_data_t *, st_data_t);
+int st_insert(st_table *, st_data_t, st_data_t);
+int st_lookup(st_table *, st_data_t, st_data_t *);
+void st_foreach(st_table *, st_each_func_t, st_data_t);
+void st_add_direct(st_table *, st_data_t, st_data_t);
+void st_free_table(st_table *);
+void st_cleanup_safe(st_table *, st_data_t);
+st_table *st_copy(st_table *);
+
+#define ST_NUMCMP ((st_compare_func_t) 0)
+#define ST_NUMHASH ((st_hash_func_t) -2)
#define st_numcmp ST_NUMCMP
#define st_numhash ST_NUMHASH
diff --git a/variable.c b/variable.c
index aec1d92..a31a8c3 100644
--- a/variable.c
+++ b/variable.c
@@ -94,7 +94,7 @@ fc_i(key, value, res)
arg.klass = res->klass;
arg.track = value;
arg.prev = res;
- st_foreach(RCLASS(value)->iv_tbl, fc_i, &arg);
+ st_foreach(RCLASS(value)->iv_tbl, fc_i, (st_data_t)&arg);
if (arg.path) {
res->path = arg.path;
return ST_STOP;
@@ -121,10 +121,10 @@ find_class_path(klass)
arg.track = rb_cObject;
arg.prev = 0;
if (RCLASS(rb_cObject)->iv_tbl) {
- st_foreach(RCLASS(rb_cObject)->iv_tbl, fc_i, &arg);
+ st_foreach(RCLASS(rb_cObject)->iv_tbl, fc_i, (st_data_t)&arg);
}
if (arg.path == 0) {
- st_foreach(rb_class_tbl, fc_i, &arg);
+ st_foreach(rb_class_tbl, fc_i, (st_data_t)&arg);
}
if (arg.path) {
if (!ROBJECT(klass)->iv_tbl) {
@@ -286,7 +286,7 @@ rb_autoload_id(id, filename)
if (!autoload_tbl) {
autoload_tbl = st_init_numtable();
}
- st_insert(autoload_tbl, id, strdup(filename));
+ st_insert(autoload_tbl, id, (st_data_t)strdup(filename));
}
void
@@ -351,7 +351,7 @@ rb_global_entry(id)
{
struct global_entry *entry;
- if (!st_lookup(rb_global_tbl, id, &entry)) {
+ if (!st_lookup(rb_global_tbl, id, (st_data_t *)&entry)) {
struct global_variable *var;
entry = ALLOC(struct global_entry);
var = ALLOC(struct global_variable);
@@ -365,7 +365,7 @@ rb_global_entry(id)
var->block_trace = 0;
var->trace = 0;
- st_add_direct(rb_global_tbl, id, entry);
+ st_add_direct(rb_global_tbl, id, (st_data_t)entry);
}
return entry;
}
@@ -612,7 +612,7 @@ rb_f_untrace_var(argc, argv)
rb_scan_args(argc, argv, "11", &var, &cmd);
id = rb_to_id(var);
- if (!st_lookup(rb_global_tbl, id, &entry)) {
+ if (!st_lookup(rb_global_tbl, id, (st_data_t *)&entry)) {
rb_name_error(id, "undefined global variable %s", rb_id2name(id));
}
@@ -766,10 +766,10 @@ rb_alias_variable(name1, name2)
rb_raise(rb_eSecurityError, "Insecure: can't alias global variable");
entry2 = rb_global_entry(name2);
- if (!st_lookup(rb_global_tbl, name1, &entry1)) {
+ if (!st_lookup(rb_global_tbl, name1, (st_data_t *)&entry1)) {
entry1 = ALLOC(struct global_entry);
entry1->id = name1;
- st_add_direct(rb_global_tbl, name1, entry1);
+ st_add_direct(rb_global_tbl, name1, (st_data_t)entry1);
}
else if (entry1->var != entry2->var) {
struct global_variable *var = entry1->var;
@@ -804,7 +804,7 @@ rb_generic_ivar_table(obj)
st_table *tbl;
if (!generic_iv_tbl) return 0;
- if (!st_lookup(generic_iv_tbl, obj, &tbl)) return 0;
+ if (!st_lookup(generic_iv_tbl, obj, (st_data_t *)&tbl)) return 0;
return tbl;
}
@@ -817,7 +817,7 @@ generic_ivar_get(obj, id)
VALUE val;
if (generic_iv_tbl) {
- if (st_lookup(generic_iv_tbl, obj, &tbl)) {
+ if (st_lookup(generic_iv_tbl, obj, (st_data_t *)&tbl)) {
if (st_lookup(tbl, id, &val)) {
return val;
}
@@ -843,10 +843,10 @@ generic_ivar_set(obj, id, val)
generic_iv_tbl = st_init_numtable();
}
- if (!st_lookup(generic_iv_tbl, obj, &tbl)) {
+ if (!st_lookup(generic_iv_tbl, obj, (st_data_t *)&tbl)) {
FL_SET(obj, FL_EXIVAR);
tbl = st_init_numtable();
- st_add_direct(generic_iv_tbl, obj, tbl);
+ st_add_direct(generic_iv_tbl, obj, (st_data_t)tbl);
st_add_direct(tbl, id, val);
return;
}
@@ -862,7 +862,7 @@ generic_ivar_defined(obj, id)
VALUE val;
if (!generic_iv_tbl) return Qfalse;
- if (!st_lookup(generic_iv_tbl, obj, &tbl)) return Qfalse;
+ if (!st_lookup(generic_iv_tbl, obj, (st_data_t *)&tbl)) return Qfalse;
if (st_lookup(tbl, id, &val)) {
return Qtrue;
}
@@ -879,10 +879,10 @@ generic_ivar_remove(obj, id, valp)
int status;
if (!generic_iv_tbl) return 0;
- if (!st_lookup(generic_iv_tbl, obj, &tbl)) return 0;
+ if (!st_lookup(generic_iv_tbl, obj, (st_data_t *)&tbl)) return 0;
status = st_delete(tbl, &id, valp);
if (tbl->num_entries == 0) {
- st_delete(generic_iv_tbl, &obj, &tbl);
+ st_delete(generic_iv_tbl, &obj, (st_data_t *)&tbl);
st_free_table(tbl);
}
return status;
@@ -895,7 +895,7 @@ rb_mark_generic_ivar(obj)
st_table *tbl;
if (!generic_iv_tbl) return;
- if (st_lookup(generic_iv_tbl, obj, &tbl)) {
+ if (st_lookup(generic_iv_tbl, obj, (st_data_t *)&tbl)) {
rb_mark_tbl(tbl);
}
}
@@ -934,7 +934,7 @@ rb_free_generic_ivar(obj)
{
st_table *tbl;
- if (st_delete(generic_iv_tbl, &obj, &tbl))
+ if (st_delete(generic_iv_tbl, &obj, (st_data_t *)&tbl))
st_free_table(tbl);
}
@@ -945,15 +945,15 @@ rb_copy_generic_ivar(clone, obj)
st_table *tbl;
if (!generic_iv_tbl) return;
- if (st_lookup(generic_iv_tbl, obj, &tbl)) {
+ if (st_lookup(generic_iv_tbl, obj, (st_data_t *)&tbl)) {
st_table *old;
- if (st_lookup(generic_iv_tbl, clone, &old)) {
+ if (st_lookup(generic_iv_tbl, clone, (st_data_t *)&old)) {
st_free_table(old);
- st_insert(generic_iv_tbl, clone, st_copy(tbl));
+ st_insert(generic_iv_tbl, clone, (st_data_t)st_copy(tbl));
}
else {
- st_add_direct(generic_iv_tbl, clone, st_copy(tbl));
+ st_add_direct(generic_iv_tbl, clone, (st_data_t)st_copy(tbl));
}
}
}
@@ -1057,7 +1057,7 @@ rb_obj_instance_variables(obj)
if (FL_TEST(obj, FL_EXIVAR) || rb_special_const_p(obj)) {
st_table *tbl;
- if (st_lookup(generic_iv_tbl, obj, &tbl)) {
+ if (st_lookup(generic_iv_tbl, obj, (st_data_t *)&tbl)) {
st_foreach(tbl, ivar_i, ary);
}
}
@@ -1143,7 +1143,7 @@ rb_autoload_load(id)
char *modname;
VALUE module;
- st_delete(autoload_tbl, &id, &modname);
+ st_delete(autoload_tbl, &id, (st_data_t *)&modname);
if (rb_provided(modname)) {
free(modname);
return;
@@ -1251,12 +1251,12 @@ rb_mod_const_at(mod, data)
tbl = st_init_numtable();
}
if (RCLASS(mod)->iv_tbl) {
- st_foreach(RCLASS(mod)->iv_tbl, sv_i, tbl);
+ st_foreach(RCLASS(mod)->iv_tbl, sv_i, (st_data_t)tbl);
}
if ((VALUE)mod == rb_cObject) {
- st_foreach(rb_class_tbl, sv_i, tbl);
+ st_foreach(rb_class_tbl, sv_i, (st_data_t)tbl);
if (autoload_tbl) {
- st_foreach(autoload_tbl, autoload_i, tbl);
+ st_foreach(autoload_tbl, autoload_i, (st_data_t)tbl);
}
}
return tbl;
@@ -1410,7 +1410,7 @@ rb_const_assign(klass, id, val)
if (autoload_tbl && st_lookup(autoload_tbl, id, 0)) {
char *modname;
- st_delete(autoload_tbl, &id, &modname);
+ st_delete(autoload_tbl, (st_data_t *)&id, (st_data_t *)&modname);
free(modname);
st_insert(RCLASS(rb_cObject)->iv_tbl, id, val);
return;