Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
3feb3d6c
Commit
3feb3d6c
authored
11 years ago
by
Luca Barbato
Browse files
Options
Downloads
Patches
Plain Diff
mem: Introduce av_reallocp
parent
187105ff
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
doc/APIchanges
+3
-0
3 additions, 0 deletions
doc/APIchanges
libavutil/mem.c
+16
-0
16 additions, 0 deletions
libavutil/mem.c
libavutil/mem.h
+19
-0
19 additions, 0 deletions
libavutil/mem.h
libavutil/version.h
+1
-1
1 addition, 1 deletion
libavutil/version.h
with
39 additions
and
1 deletion
doc/APIchanges
+
3
−
0
View file @
3feb3d6c
...
@@ -13,6 +13,9 @@ libavutil: 2012-10-22
...
@@ -13,6 +13,9 @@ libavutil: 2012-10-22
API changes, most recent first:
API changes, most recent first:
2013-09-xx - xxxxxxx - lavu 52.13.0 - mem.h
Add av_reallocp.
2013-08-xx - xxxxxxx - lavc 55.16.0 - avcodec.h
2013-08-xx - xxxxxxx - lavc 55.16.0 - avcodec.h
Extend AVPacket API with av_packet_unref, av_packet_ref,
Extend AVPacket API with av_packet_unref, av_packet_ref,
av_packet_move_ref, av_packet_copy_props, av_packet_free_side_data.
av_packet_move_ref, av_packet_copy_props, av_packet_free_side_data.
...
...
This diff is collapsed.
Click to expand it.
libavutil/mem.c
+
16
−
0
View file @
3feb3d6c
...
@@ -136,6 +136,22 @@ void *av_realloc(void *ptr, size_t size)
...
@@ -136,6 +136,22 @@ void *av_realloc(void *ptr, size_t size)
#endif
#endif
}
}
int
av_reallocp
(
void
*
ptr
,
size_t
size
)
{
void
**
ptrptr
=
ptr
;
void
*
ret
;
ret
=
av_realloc
(
*
ptrptr
,
size
);
if
(
!
ret
)
{
av_freep
(
ptr
);
return
AVERROR
(
ENOMEM
);
}
*
ptrptr
=
ret
;
return
0
;
}
void
*
av_realloc_array
(
void
*
ptr
,
size_t
nmemb
,
size_t
size
)
void
*
av_realloc_array
(
void
*
ptr
,
size_t
nmemb
,
size_t
size
)
{
{
if
(
!
size
||
nmemb
>=
INT_MAX
/
size
)
if
(
!
size
||
nmemb
>=
INT_MAX
/
size
)
...
...
This diff is collapsed.
Click to expand it.
libavutil/mem.h
+
19
−
0
View file @
3feb3d6c
...
@@ -116,6 +116,25 @@ av_alloc_size(1, 2) static inline void *av_malloc_array(size_t nmemb, size_t siz
...
@@ -116,6 +116,25 @@ av_alloc_size(1, 2) static inline void *av_malloc_array(size_t nmemb, size_t siz
*/
*/
void
*
av_realloc
(
void
*
ptr
,
size_t
size
)
av_alloc_size
(
2
);
void
*
av_realloc
(
void
*
ptr
,
size_t
size
)
av_alloc_size
(
2
);
/**
* Allocate or reallocate a block of memory.
* If *ptr is NULL and size > 0, allocate a new block. If
* size is zero, free the memory block pointed to by ptr.
* @param ptr Pointer to a pointer to a memory block already allocated
* with av_realloc(), or pointer to a pointer to NULL.
* The pointer is updated on success, or freed on failure.
* @param size Size in bytes for the memory block to be allocated or
* reallocated
* @return Zero on success, an AVERROR error code on failure.
* @warning Pointers originating from the av_malloc() family of functions must
* not be passed to av_reallocp(). The former can be implemented using
* memalign() (or other functions), and there is no guarantee that
* pointers from such functions can be passed to realloc() at all.
* The situation is undefined according to POSIX and may crash with
* some libc implementations.
*/
int
av_reallocp
(
void
*
ptr
,
size_t
size
);
/**
/**
* Allocate or reallocate an array.
* Allocate or reallocate an array.
* If ptr is NULL and nmemb > 0, allocate a new block. If
* If ptr is NULL and nmemb > 0, allocate a new block. If
...
...
This diff is collapsed.
Click to expand it.
libavutil/version.h
+
1
−
1
View file @
3feb3d6c
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
*/
*/
#define LIBAVUTIL_VERSION_MAJOR 52
#define LIBAVUTIL_VERSION_MAJOR 52
#define LIBAVUTIL_VERSION_MINOR 1
4
#define LIBAVUTIL_VERSION_MINOR 1
5
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment