Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
ccecab4a
Commit
ccecab4a
authored
Sep 24, 2011
by
Laurent Aimar
Committed by
Michael Niedermayer
Sep 24, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add av_calloc() helper.
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
35cb6854
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
mem.c
libavutil/mem.c
+7
-0
mem.h
libavutil/mem.h
+12
-0
No files found.
libavutil/mem.c
View file @
ccecab4a
...
@@ -168,6 +168,13 @@ void *av_mallocz(size_t size)
...
@@ -168,6 +168,13 @@ void *av_mallocz(size_t size)
return
ptr
;
return
ptr
;
}
}
void
*
av_calloc
(
size_t
nmemb
,
size_t
size
)
{
if
(
size
<=
0
||
nmemb
>=
INT_MAX
/
size
)
return
NULL
;
return
av_mallocz
(
nmemb
*
size
);
}
char
*
av_strdup
(
const
char
*
s
)
char
*
av_strdup
(
const
char
*
s
)
{
{
char
*
ptr
=
NULL
;
char
*
ptr
=
NULL
;
...
...
libavutil/mem.h
View file @
ccecab4a
...
@@ -106,6 +106,18 @@ void av_free(void *ptr);
...
@@ -106,6 +106,18 @@ void av_free(void *ptr);
*/
*/
void
*
av_mallocz
(
size_t
size
)
av_malloc_attrib
av_alloc_size
(
1
);
void
*
av_mallocz
(
size_t
size
)
av_malloc_attrib
av_alloc_size
(
1
);
/**
* Allocate a block of nmemb * size bytes with alignment suitable for all
* memory accesses (including vectors if available on the CPU) and
* zero all the bytes of the block.
* The allocation will fail if nmemb * size is greater than or equal
* to INT_MAX.
* @param nmemb
* @param size
* @return Pointer to the allocated block, NULL if it cannot be allocated.
*/
void
*
av_calloc
(
size_t
nmemb
,
size_t
size
)
av_malloc_attrib
;
/**
/**
* Duplicate the string s.
* Duplicate the string s.
* @param s string to be duplicated
* @param s string to be duplicated
...
...
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