Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
de133c37
Commit
de133c37
authored
Jun 02, 2012
by
Yukihiro Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring around mrb_hash_new
parent
d9dfbb04
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
include/mruby/hash.h
include/mruby/hash.h
+2
-2
src/hash.c
src/hash.c
+6
-4
No files found.
include/mruby/hash.h
View file @
de133c37
...
...
@@ -20,8 +20,8 @@ struct RHash {
#define mrb_hash_ptr(v) ((struct RHash*)((v).value.p))
#define mrb_hash_value(p) mrb_obj_value((void*)(p))
mrb_value
mrb_hash_new_capa
(
mrb_state
*
,
size_
t
);
mrb_value
mrb_hash_new
(
mrb_state
*
mrb
,
int
capa
);
mrb_value
mrb_hash_new_capa
(
mrb_state
*
,
in
t
);
mrb_value
mrb_hash_new
(
mrb_state
*
mrb
);
void
mrb_hash_set
(
mrb_state
*
mrb
,
mrb_value
hash
,
mrb_value
key
,
mrb_value
val
);
mrb_value
mrb_hash_get
(
mrb_state
*
mrb
,
mrb_value
hash
,
mrb_value
key
);
...
...
src/hash.c
View file @
de133c37
...
...
@@ -81,21 +81,23 @@ mrb_gc_free_ht(mrb_state *mrb, struct RHash *hash)
mrb_value
mrb_hash_new_capa
(
mrb_state
*
mrb
,
size_
t
capa
)
mrb_hash_new_capa
(
mrb_state
*
mrb
,
in
t
capa
)
{
struct
RHash
*
h
;
h
=
(
struct
RHash
*
)
mrb_obj_alloc
(
mrb
,
MRB_TT_HASH
,
mrb
->
hash_class
);
h
->
ht
=
kh_init
(
ht
,
mrb
);
if
(
capa
>
0
)
{
kh_resize
(
ht
,
h
->
ht
,
capa
);
}
h
->
iv
=
0
;
return
mrb_obj_value
(
h
);
}
mrb_value
mrb_hash_new
(
mrb_state
*
mrb
,
int
capa
)
mrb_hash_new
(
mrb_state
*
mrb
)
{
return
mrb_hash_new_capa
(
mrb
,
capa
);
return
mrb_hash_new_capa
(
mrb
,
0
);
}
mrb_value
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment