Mercurial > libavutil.hg
changeset 777:9b87c6b537bb libavutil
Rename CHECKED_ALLOC(Z) to FF_ALLOC(Z)_OR_GOTO and add context and label
parameters.
author | ramiro |
---|---|
date | Sun, 06 Sep 2009 00:08:19 +0000 |
parents | 0c82f8789664 |
children | 81aecbb6bbb2 |
files | internal.h |
diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/internal.h Sat Sep 05 23:33:25 2009 +0000 +++ b/internal.h Sun Sep 06 00:08:19 2009 +0000 @@ -249,21 +249,21 @@ #define perror please_use_av_log_instead_of_perror #endif -#define CHECKED_ALLOC(p, size)\ +#define FF_ALLOC_OR_GOTO(ctx, p, size, label)\ {\ p = av_malloc(size);\ if (p == NULL && (size) != 0) {\ - av_log(NULL, AV_LOG_ERROR, "Cannot allocate memory.\n");\ - goto fail;\ + av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\ + goto label;\ }\ } -#define CHECKED_ALLOCZ(p, size)\ +#define FF_ALLOCZ_OR_GOTO(ctx, p, size, label)\ {\ p = av_mallocz(size);\ if (p == NULL && (size) != 0) {\ - av_log(NULL, AV_LOG_ERROR, "Cannot allocate memory.\n");\ - goto fail;\ + av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\ + goto label;\ }\ }