mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Helper functions for st_foreach() return "enum st_retval" not "int"
Just making this a bit more consistent throughout the code
This commit is contained in:
+6
-6
@@ -913,11 +913,11 @@ enc_name(mrb_state *mrb, mrb_value self)
|
||||
|
||||
struct fn_arg {
|
||||
mrb_state *mrb;
|
||||
int (*func)(ANYARGS);
|
||||
enum st_retval (*func)(ANYARGS);
|
||||
void *a;
|
||||
};
|
||||
|
||||
static int
|
||||
static enum st_retval
|
||||
fn_i(st_data_t key, st_data_t val, st_data_t arg) {
|
||||
struct fn_arg *a = (struct fn_arg*)arg;
|
||||
|
||||
@@ -925,7 +925,7 @@ fn_i(st_data_t key, st_data_t val, st_data_t arg) {
|
||||
}
|
||||
|
||||
static int
|
||||
st_foreachNew(mrb_state *mrb, st_table *tbl, int (*func)(ANYARGS), void *a)
|
||||
st_foreachNew(mrb_state *mrb, st_table *tbl, enum st_retval (*func)(ANYARGS), void *a)
|
||||
{
|
||||
struct fn_arg arg = {
|
||||
mrb,
|
||||
@@ -936,7 +936,7 @@ st_foreachNew(mrb_state *mrb, st_table *tbl, int (*func)(ANYARGS), void *a)
|
||||
return st_foreach(tbl, fn_i, (st_data_t)&arg);
|
||||
}
|
||||
|
||||
static int
|
||||
static enum st_retval
|
||||
enc_names_i(mrb_state *mrb, st_data_t name, st_data_t idx, st_data_t args)
|
||||
{
|
||||
mrb_value *arg = (mrb_value *)args;
|
||||
@@ -1521,7 +1521,7 @@ set_encoding_const(mrb_state *mrb, const char *name, mrb_encoding *enc)
|
||||
}
|
||||
}
|
||||
}
|
||||
static int
|
||||
static enum st_retval
|
||||
mrb_enc_name_list_i(mrb_state *mrb, st_data_t name, st_data_t idx, mrb_value *arg)
|
||||
{
|
||||
mrb_value ary = *arg;
|
||||
@@ -1554,7 +1554,7 @@ mrb_enc_name_list(mrb_state *mrb, mrb_value klass)
|
||||
return ary;
|
||||
}
|
||||
|
||||
static int
|
||||
static enum st_retval
|
||||
mrb_enc_aliases_enc_i(mrb_state *mrb, st_data_t name, st_data_t orig, st_data_t arg)
|
||||
{
|
||||
mrb_value *p = (mrb_value *)arg;
|
||||
|
||||
+5
-5
@@ -416,7 +416,7 @@ typedef st_data_t HashDataType; /* 1.6 st.h doesn't define st_data_t type */
|
||||
#define NAMEBUF_SIZE_1 25
|
||||
|
||||
#ifdef ONIG_DEBUG
|
||||
static int
|
||||
static enum st_retval
|
||||
i_print_name_entry(UChar* key, NameEntry* e, void* arg)
|
||||
{
|
||||
int i;
|
||||
@@ -451,7 +451,7 @@ onig_print_names(FILE* fp, regex_t* reg)
|
||||
}
|
||||
#endif /* ONIG_DEBUG */
|
||||
|
||||
static int
|
||||
static enum st_retval
|
||||
i_free_name_entry(UChar* key, NameEntry* e, void* arg ARG_UNUSED)
|
||||
{
|
||||
xfree(e->name);
|
||||
@@ -508,7 +508,7 @@ typedef struct {
|
||||
OnigEncoding enc;
|
||||
} INamesArg;
|
||||
|
||||
static int
|
||||
static enum st_retval
|
||||
i_names(UChar* key ARG_UNUSED, NameEntry* e, INamesArg* arg)
|
||||
{
|
||||
int r = (*(arg->func))(e->name,
|
||||
@@ -541,7 +541,7 @@ onig_foreach_name(regex_t* reg,
|
||||
return narg.ret;
|
||||
}
|
||||
|
||||
static int
|
||||
static enum st_retval
|
||||
i_renumber_name(UChar* key ARG_UNUSED, NameEntry* e, GroupNumRemap* map)
|
||||
{
|
||||
int i;
|
||||
@@ -4922,7 +4922,7 @@ static const struct st_hash_type type_type_cclass_hash = {
|
||||
static st_table* OnigTypeCClassTable;
|
||||
|
||||
|
||||
static int
|
||||
static enum st_retval
|
||||
i_free_shared_class(type_cclass_key* key, Node* node, void* arg ARG_UNUSED)
|
||||
{
|
||||
if (IS_NOT_NULL(node)) {
|
||||
|
||||
@@ -404,7 +404,7 @@ st_delete(register st_table *table, register st_data_t *key, st_data_t *value)
|
||||
}
|
||||
|
||||
int
|
||||
st_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
|
||||
st_foreach(st_table *table, enum st_retval (*func)(ANYARGS), st_data_t arg)
|
||||
{
|
||||
st_table_entry *ptr, **last, *tmp;
|
||||
enum st_retval retval;
|
||||
@@ -572,7 +572,7 @@ numhash(long n)
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int
|
||||
static enum st_retval
|
||||
f(st_data_t key, st_data_t val, st_data_t a)
|
||||
{
|
||||
printf("tbl=%p key=%s val=%s\n", (st_table*)a, (char*)key, (char*)val);
|
||||
|
||||
@@ -74,7 +74,7 @@ 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 *);
|
||||
int st_foreach(st_table *, int (*)(ANYARGS), st_data_t);
|
||||
int st_foreach(st_table *, enum st_retval (*)(ANYARGS), 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);
|
||||
|
||||
+2
-2
@@ -273,7 +273,7 @@ typedef struct {
|
||||
const char *base_enc;
|
||||
} search_path_bfs_t;
|
||||
|
||||
static int
|
||||
static enum st_retval
|
||||
transcode_search_path_i(st_data_t key, st_data_t val, st_data_t arg)
|
||||
{
|
||||
const char *dname = (const char *)key;
|
||||
@@ -1797,7 +1797,7 @@ struct asciicompat_encoding_t {
|
||||
const char *ascii_incompat_name;
|
||||
};
|
||||
|
||||
static int
|
||||
static enum st_retval
|
||||
asciicompat_encoding_i(mrb_state *mrb, st_data_t key, st_data_t val, st_data_t arg)
|
||||
{
|
||||
struct asciicompat_encoding_t *data = (struct asciicompat_encoding_t *)arg;
|
||||
|
||||
Reference in New Issue
Block a user