mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
move KHASH_DECLARE(ht..) to mruby/hash.h; close #3073
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#define MRUBY_HASH_H
|
||||
|
||||
#include "common.h"
|
||||
#include <mruby/khash.h>
|
||||
|
||||
/**
|
||||
* Hash class
|
||||
@@ -59,6 +60,15 @@ MRB_API mrb_value mrb_hash_empty_p(mrb_state *mrb, mrb_value self);
|
||||
*/
|
||||
MRB_API mrb_value mrb_hash_clear(mrb_state *mrb, mrb_value hash);
|
||||
|
||||
/* declaration of struct kh_ht */
|
||||
/* be careful when you touch the internal */
|
||||
typedef struct {
|
||||
mrb_value v;
|
||||
mrb_int n;
|
||||
} mrb_hash_value;
|
||||
|
||||
KHASH_DECLARE(ht, mrb_value, mrb_hash_value, TRUE)
|
||||
|
||||
/* RHASH_TBL allocates st_table if not available. */
|
||||
#define RHASH(obj) ((struct RHash*)(mrb_ptr(obj)))
|
||||
#define RHASH_TBL(h) (RHASH(h)->ht)
|
||||
|
||||
@@ -91,12 +91,6 @@ mrb_hash_ht_hash_equal(mrb_state *mrb, mrb_value a, mrb_value b)
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
mrb_value v;
|
||||
mrb_int n;
|
||||
} mrb_hash_value;
|
||||
|
||||
KHASH_DECLARE(ht, mrb_value, mrb_hash_value, TRUE)
|
||||
KHASH_DEFINE (ht, mrb_value, mrb_hash_value, TRUE, mrb_hash_ht_hash_func, mrb_hash_ht_hash_equal)
|
||||
|
||||
static void mrb_hash_modify(mrb_state *mrb, mrb_value hash);
|
||||
|
||||
Reference in New Issue
Block a user