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
fc9a91c4
Commit
fc9a91c4
authored
Jul 17, 2014
by
take_cheeze
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add field `allocf_ud` to replace current `ud`.
Since some use it as `mrb_state` associated user data.
parent
d17506c1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
4 deletions
+5
-4
include/mruby.h
include/mruby.h
+1
-0
src/gc.c
src/gc.c
+3
-3
src/state.c
src/state.c
+1
-1
No files found.
include/mruby.h
View file @
fc9a91c4
...
...
@@ -112,6 +112,7 @@ typedef struct mrb_state {
struct
mrb_jmpbuf
*
jmp
;
mrb_allocf
allocf
;
/* memory allocation function */
void
*
allocf_ud
;
/* auxiliary data of allocf */
struct
mrb_context
*
c
;
struct
mrb_context
*
root_c
;
...
...
src/gc.c
View file @
fc9a91c4
...
...
@@ -171,10 +171,10 @@ mrb_realloc_simple(mrb_state *mrb, void *p, size_t len)
{
void
*
p2
;
p2
=
(
mrb
->
allocf
)(
mrb
,
p
,
len
,
mrb
->
ud
);
p2
=
(
mrb
->
allocf
)(
mrb
,
p
,
len
,
mrb
->
allocf_
ud
);
if
(
!
p2
&&
len
>
0
&&
mrb
->
heaps
)
{
mrb_full_gc
(
mrb
);
p2
=
(
mrb
->
allocf
)(
mrb
,
p
,
len
,
mrb
->
ud
);
p2
=
(
mrb
->
allocf
)(
mrb
,
p
,
len
,
mrb
->
allocf_
ud
);
}
return
p2
;
...
...
@@ -240,7 +240,7 @@ mrb_calloc(mrb_state *mrb, size_t nelem, size_t len)
void
mrb_free
(
mrb_state
*
mrb
,
void
*
p
)
{
(
mrb
->
allocf
)(
mrb
,
p
,
0
,
mrb
->
ud
);
(
mrb
->
allocf
)(
mrb
,
p
,
0
,
mrb
->
allocf_
ud
);
}
#ifndef MRB_HEAP_PAGE_SIZE
...
...
src/state.c
View file @
fc9a91c4
...
...
@@ -37,7 +37,7 @@ mrb_open_core(mrb_allocf f, void *ud)
if
(
mrb
==
NULL
)
return
NULL
;
*
mrb
=
mrb_state_zero
;
mrb
->
ud
=
ud
;
mrb
->
allocf_
ud
=
ud
;
mrb
->
allocf
=
f
;
mrb
->
current_white_part
=
MRB_GC_WHITE_A
;
mrb
->
atexit_stack_len
=
0
;
...
...
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