History

avutil/mem: Add av_fast_mallocz()

Michael Niedermayer committed 10 years ago

Commit fc91eea1 parent 518742b4 files · +23 −1Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libavutil/mem.c +4 −0
  3. libavutil/mem.h +15 −0
  4. libavutil/version.h +1 −1
doc/APIchanges+3−0
@@ -15,6 +15,9 @@ libavutil: 2015-08-28 · 14 unmodified lines
15 15
16API changes, most recent first:16API changes, most recent first:
17 17
182015-11-18 - lavu 55.7.100 - mem.h
19 Add av_fast_mallocz()
20
182015-10-29 - lavc 57.12.100 / 57.8.0 - avcodec.h212015-10-29 - lavc 57.12.100 / 57.8.0 - avcodec.h
19 xxxxxx - Deprecate av_free_packet(). Use av_packet_unref() as replacement,22 xxxxxx - Deprecate av_free_packet(). Use av_packet_unref() as replacement,
20 it resets the packet in a more consistent way.23 it resets the packet in a more consistent way.
libavutil/mem.c+4−0
@@ -501,3 +501,7 @@ void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size) · 500 unmodified lines
501 ff_fast_malloc(ptr, size, min_size, 0);501 ff_fast_malloc(ptr, size, min_size, 0);
502}502}
503 503
504void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size)
505{
506 ff_fast_malloc(ptr, size, min_size, 1);
507}
libavutil/mem.h+15−0
@@ -384,6 +384,21 @@ void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size); · 383 unmodified lines
384 */384 */
385void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size);385void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size);
386 386
387/**
388 * Allocate a buffer, reusing the given one if large enough.
389 *
390 * All newly allocated space is initially cleared
391 * Contrary to av_fast_realloc the current buffer contents might not be
392 * preserved and on error the old buffer is freed, thus no special
393 * handling to avoid memleaks is necessary.
394 *
395 * @param ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer
396 * @param size size of the buffer *ptr points to
397 * @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and
398 * *size 0 if an error occurred.
399 */
400void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size);
401
387/**402/**
388 * @}403 * @}
389 */404 */
libavutil/version.h+1−1
@@ -56,7 +56,7 @@ · 55 unmodified lines
56 */56 */
57 57
58#define LIBAVUTIL_VERSION_MAJOR 5558#define LIBAVUTIL_VERSION_MAJOR 55
59#define LIBAVUTIL_VERSION_MINOR 659#define LIBAVUTIL_VERSION_MINOR 7
60#define LIBAVUTIL_VERSION_MICRO 10060#define LIBAVUTIL_VERSION_MICRO 100
61 61
62#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \62#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t