Beispiel #1
0
MRB_API mrb_value
mrb_hash_new_capa(mrb_state *mrb, mrb_int capa)
{
  struct RHash *h;

  h = (struct RHash*)mrb_obj_alloc(mrb, MRB_TT_HASH, mrb->hash_class);
  /* khash needs 1/4 empty space so it is not resized immediately */
  h->ht = kh_init_size(ht, mrb, capa*4/3);
  h->iv = 0;
  return mrb_obj_value(h);
}
Beispiel #2
0
static iv_tbl*
iv_new(mrb_state *mrb)
{
    return (iv_tbl*)kh_init_size(iv, mrb, MRB_IVHASH_INIT_SIZE);
}