comparison avcodec.h @ 9415:141badec76fc libavcodec

Add a av_fast_malloc function and replace several uses of av_fast_realloc, thus avoiding potential memleaks and pointless memcpys.
author reimar
date Sun, 12 Apr 2009 13:17:37 +0000
parents e6ade5c8a750
children bdb94921332a
comparison
equal deleted inserted replaced
9414:5a738e8f9524 9415:141badec76fc
3539 * @see av_realloc 3539 * @see av_realloc
3540 */ 3540 */
3541 void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size); 3541 void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size);
3542 3542
3543 /** 3543 /**
3544 * Allocates a buffer, reusing the given one if large enough.
3545 *
3546 * Contrary to av_fast_realloc the current buffer contents might not be
3547 * preserved and on error the old buffer is freed, thus no special
3548 * handling to avoid memleaks is necessary.
3549 *
3550 * @param ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer
3551 * @param size size of the buffer *ptr points to
3552 * @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and
3553 * *size 0 if an error occurred.
3554 */
3555 void av_fast_malloc(void *ptr, unsigned int *size, unsigned int min_size);
3556
3557 /**
3544 * Copy image 'src' to 'dst'. 3558 * Copy image 'src' to 'dst'.
3545 */ 3559 */
3546 void av_picture_copy(AVPicture *dst, const AVPicture *src, 3560 void av_picture_copy(AVPicture *dst, const AVPicture *src,
3547 enum PixelFormat pix_fmt, int width, int height); 3561 enum PixelFormat pix_fmt, int width, int height);
3548 3562