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
378c7283
Commit
378c7283
authored
Dec 11, 2018
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update comments.
parent
c0d91a14
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
src/hash.c
src/hash.c
+9
-9
No files found.
src/hash.c
View file @
378c7283
...
@@ -38,7 +38,7 @@ typedef struct segindex {
...
@@ -38,7 +38,7 @@ typedef struct segindex {
struct
segkv
*
table
[];
struct
segkv
*
table
[];
}
segindex
;
}
segindex
;
/*
Instance variable
table structure */
/*
hash
table structure */
typedef
struct
htable
{
typedef
struct
htable
{
segment
*
rootseg
;
segment
*
rootseg
;
segment
*
lastseg
;
segment
*
lastseg
;
...
@@ -132,7 +132,7 @@ ht_hash_equal(mrb_state *mrb, htable *t, mrb_value a, mrb_value b)
...
@@ -132,7 +132,7 @@ ht_hash_equal(mrb_state *mrb, htable *t, mrb_value a, mrb_value b)
}
}
}
}
/* Creates the
instance variable
table. */
/* Creates the
hash
table. */
static
htable
*
static
htable
*
ht_new
(
mrb_state
*
mrb
)
ht_new
(
mrb_state
*
mrb
)
{
{
...
@@ -346,7 +346,7 @@ ht_index_put(mrb_state *mrb, htable *t, mrb_value key, mrb_value val)
...
@@ -346,7 +346,7 @@ ht_index_put(mrb_state *mrb, htable *t, mrb_value key, mrb_value val)
t
->
size
++
;
t
->
size
++
;
}
}
/* Set the value for the key in the table. */
/* Set the value for the key in the
hash
table. */
static
void
static
void
ht_put
(
mrb_state
*
mrb
,
htable
*
t
,
mrb_value
key
,
mrb_value
val
)
ht_put
(
mrb_state
*
mrb
,
htable
*
t
,
mrb_value
key
,
mrb_value
val
)
{
{
...
@@ -465,7 +465,7 @@ ht_get(mrb_state *mrb, htable *t, mrb_value key, mrb_value *vp)
...
@@ -465,7 +465,7 @@ ht_get(mrb_state *mrb, htable *t, mrb_value key, mrb_value *vp)
return
FALSE
;
return
FALSE
;
}
}
/* Deletes the value for the symbol from the
instance variable
table. */
/* Deletes the value for the symbol from the
hash
table. */
/* Deletion is done by overwriting keys by `undef`. */
/* Deletion is done by overwriting keys by `undef`. */
static
mrb_bool
static
mrb_bool
ht_del
(
mrb_state
*
mrb
,
htable
*
t
,
mrb_value
key
,
mrb_value
*
vp
)
ht_del
(
mrb_state
*
mrb
,
htable
*
t
,
mrb_value
key
,
mrb_value
*
vp
)
...
@@ -496,7 +496,7 @@ ht_del(mrb_state *mrb, htable *t, mrb_value key, mrb_value *vp)
...
@@ -496,7 +496,7 @@ ht_del(mrb_state *mrb, htable *t, mrb_value key, mrb_value *vp)
return
FALSE
;
return
FALSE
;
}
}
/* Iterates over the
instance variable
table. */
/* Iterates over the
hash
table. */
static
void
static
void
ht_foreach
(
mrb_state
*
mrb
,
htable
*
t
,
ht_foreach_func
*
func
,
void
*
p
)
ht_foreach
(
mrb_state
*
mrb
,
htable
*
t
,
ht_foreach_func
*
func
,
void
*
p
)
{
{
...
@@ -519,14 +519,14 @@ ht_foreach(mrb_state *mrb, htable *t, ht_foreach_func *func, void *p)
...
@@ -519,14 +519,14 @@ ht_foreach(mrb_state *mrb, htable *t, ht_foreach_func *func, void *p)
}
}
}
}
/* Iterates over the
instance variable
table. */
/* Iterates over the
hash
table. */
MRB_API
void
MRB_API
void
mrb_hash_foreach
(
mrb_state
*
mrb
,
struct
RHash
*
hash
,
ht_foreach_func
*
func
,
void
*
p
)
mrb_hash_foreach
(
mrb_state
*
mrb
,
struct
RHash
*
hash
,
ht_foreach_func
*
func
,
void
*
p
)
{
{
ht_foreach
(
mrb
,
hash
->
ht
,
func
,
p
);
ht_foreach
(
mrb
,
hash
->
ht
,
func
,
p
);
}
}
/* Copy the
instance variable
table. */
/* Copy the
hash
table. */
static
htable
*
static
htable
*
ht_copy
(
mrb_state
*
mrb
,
htable
*
t
)
ht_copy
(
mrb_state
*
mrb
,
htable
*
t
)
{
{
...
@@ -552,7 +552,7 @@ ht_copy(mrb_state *mrb, htable *t)
...
@@ -552,7 +552,7 @@ ht_copy(mrb_state *mrb, htable *t)
return
t2
;
return
t2
;
}
}
/* Free memory of the
instance variable
table. */
/* Free memory of the
hash
table. */
static
void
static
void
ht_free
(
mrb_state
*
mrb
,
htable
*
t
)
ht_free
(
mrb_state
*
mrb
,
htable
*
t
)
{
{
...
@@ -1012,7 +1012,7 @@ mrb_hash_delete(mrb_state *mrb, mrb_value self)
...
@@ -1012,7 +1012,7 @@ mrb_hash_delete(mrb_state *mrb, mrb_value self)
return
mrb_hash_delete_key
(
mrb
,
self
,
key
);
return
mrb_hash_delete_key
(
mrb
,
self
,
key
);
}
}
/* find first element in
a
hash table, and remove it. */
/* find first element in
the
hash table, and remove it. */
static
void
static
void
ht_shift
(
mrb_state
*
mrb
,
htable
*
t
,
mrb_value
*
kp
,
mrb_value
*
vp
)
ht_shift
(
mrb_state
*
mrb
,
htable
*
t
,
mrb_value
*
kp
,
mrb_value
*
vp
)
{
{
...
...
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