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
3569723a
Commit
3569723a
authored
Aug 05, 2014
by
Jun Hiroe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor obj_free() in gc.c
parent
fce644df
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
4 deletions
+4
-4
include/mruby/array.h
include/mruby/array.h
+3
-0
src/array.c
src/array.c
+0
-3
src/gc.c
src/gc.c
+1
-1
No files found.
include/mruby/array.h
View file @
3569723a
...
...
@@ -34,6 +34,9 @@ struct RArray {
#define RARRAY_LEN(a) (RARRAY(a)->len)
#define RARRAY_PTR(a) (RARRAY(a)->ptr)
#define MRB_ARY_SHARED 256
#define ARY_SHARED_P(a) ((a)->flags & MRB_ARY_SHARED)
#define ARY_SET_SHARED_FLAG(a) ((a)->flags |= MRB_ARY_SHARED)
#define ARY_UNSET_SHARED_FLAG(a) ((a)->flags &= ~MRB_ARY_SHARED)
void
mrb_ary_decref
(
mrb_state
*
,
mrb_shared_array
*
);
MRB_API
void
mrb_ary_modify
(
mrb_state
*
,
struct
RArray
*
);
...
...
src/array.c
View file @
3569723a
...
...
@@ -15,9 +15,6 @@
#define ARY_SHRINK_RATIO 5
/* must be larger than 2 */
#define ARY_C_MAX_SIZE (SIZE_MAX / sizeof(mrb_value))
#define ARY_MAX_SIZE ((ARY_C_MAX_SIZE < (size_t)MRB_INT_MAX) ? (mrb_int)ARY_C_MAX_SIZE : MRB_INT_MAX-1)
#define ARY_SHARED_P(a) ((a)->flags & MRB_ARY_SHARED)
#define ARY_SET_SHARED_FLAG(a) ((a)->flags |= MRB_ARY_SHARED)
#define ARY_UNSET_SHARED_FLAG(a) ((a)->flags &= ~MRB_ARY_SHARED)
static
inline
mrb_value
ary_elt
(
mrb_value
ary
,
mrb_int
offset
)
...
...
src/gc.c
View file @
3569723a
...
...
@@ -648,7 +648,7 @@ obj_free(mrb_state *mrb, struct RBasic *obj)
break
;
case
MRB_TT_ARRAY
:
if
(
obj
->
flags
&
MRB_ARY_SHARED
)
if
(
ARY_SHARED_P
(
obj
)
)
mrb_ary_decref
(
mrb
,
((
struct
RArray
*
)
obj
)
->
aux
.
shared
);
else
mrb_free
(
mrb
,
((
struct
RArray
*
)
obj
)
->
ptr
);
...
...
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