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
89b5039f
Commit
89b5039f
authored
Apr 27, 2013
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avutil/mem: add av_memdup()
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
663794f6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
mem.c
libavutil/mem.c
+11
-0
mem.h
libavutil/mem.h
+8
-0
No files found.
libavutil/mem.c
View file @
89b5039f
...
@@ -229,6 +229,17 @@ char *av_strdup(const char *s)
...
@@ -229,6 +229,17 @@ char *av_strdup(const char *s)
return
ptr
;
return
ptr
;
}
}
void
*
av_memdup
(
const
void
*
p
,
size_t
size
)
{
void
*
ptr
=
NULL
;
if
(
p
)
{
ptr
=
av_malloc
(
size
);
if
(
ptr
)
memcpy
(
ptr
,
p
,
size
);
}
return
ptr
;
}
void
av_dynarray_add
(
void
*
tab_ptr
,
int
*
nb_ptr
,
void
*
elem
)
void
av_dynarray_add
(
void
*
tab_ptr
,
int
*
nb_ptr
,
void
*
elem
)
{
{
/* see similar ffmpeg.c:grow_array() */
/* see similar ffmpeg.c:grow_array() */
...
...
libavutil/mem.h
View file @
89b5039f
...
@@ -179,6 +179,14 @@ av_alloc_size(1, 2) static inline void *av_mallocz_array(size_t nmemb, size_t si
...
@@ -179,6 +179,14 @@ av_alloc_size(1, 2) static inline void *av_mallocz_array(size_t nmemb, size_t si
*/
*/
char
*
av_strdup
(
const
char
*
s
)
av_malloc_attrib
;
char
*
av_strdup
(
const
char
*
s
)
av_malloc_attrib
;
/**
* Duplicate the buffer p.
* @param p buffer to be duplicated
* @return Pointer to a newly allocated buffer containing a
* copy of p or NULL if the buffer cannot be allocated.
*/
void
*
av_memdup
(
const
void
*
p
,
size_t
size
);
/**
/**
* Free a memory block which has been allocated with av_malloc(z)() or
* Free a memory block which has been allocated with av_malloc(z)() or
* av_realloc() and set the pointer pointing to it to NULL.
* av_realloc() and set the pointer pointing to it to NULL.
...
...
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