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
7eb86a4a
Commit
7eb86a4a
authored
Jul 07, 2012
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #351 from monaka/pr-brush-up-mrb_calloc
Brush up mrb_calloc().
parents
3b8ad4c3
a064038d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
src/gc.c
src/gc.c
+10
-3
No files found.
src/gc.c
View file @
7eb86a4a
...
...
@@ -167,10 +167,17 @@ mrb_malloc(mrb_state *mrb, size_t len)
void
*
mrb_calloc
(
mrb_state
*
mrb
,
size_t
nelem
,
size_t
len
)
{
void
*
p
=
mrb_realloc
(
mrb
,
0
,
nelem
*
len
);
void
*
p
=
NULL
;
size_t
size
;
if
(
nelem
<=
SIZE_MAX
/
len
)
{
size
=
nelem
*
len
;
p
=
mrb_realloc
(
mrb
,
0
,
size
);
if
(
p
&&
size
>
0
)
memset
(
p
,
0
,
size
);
}
if
(
len
>
0
)
memset
(
p
,
0
,
nelem
*
len
);
return
p
;
}
...
...
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