From ae1b4f8884c4a2e973845f3b7a2f175a0c740bd8 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 7 Jan 2015 02:59:07 +0100 Subject: [PATCH] Start documenting scaler in libretro-SDK too --- libretro-sdk/file/dir_list.c | 2 +- libretro-sdk/gfx/scaler/scaler.c | 27 ++++++++++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/libretro-sdk/file/dir_list.c b/libretro-sdk/file/dir_list.c index 80ff190a14..2cb10bfc82 100644 --- a/libretro-sdk/file/dir_list.c +++ b/libretro-sdk/file/dir_list.c @@ -96,7 +96,7 @@ void dir_list_sort(struct string_list *list, bool dir_first) * dir_list_free: * @list : pointer to the directory listing * - * Free a directory listing. + * Frees a directory listing. * **/ void dir_list_free(struct string_list *list) diff --git a/libretro-sdk/gfx/scaler/scaler.c b/libretro-sdk/gfx/scaler/scaler.c index 085dffc38c..0685ee3b5f 100644 --- a/libretro-sdk/gfx/scaler/scaler.c +++ b/libretro-sdk/gfx/scaler/scaler.c @@ -29,15 +29,36 @@ #include #include -// In case aligned allocs are needed later ... +/* In case aligned allocs are needed later. */ + +/** + * scaler_alloc: + * @elem_size : size of the elements to be used. + * @siz : size of the image that the scaler needs to handle. + * + * Allocate and returns a scaler object. + * + * Returns: pointer to a scaler object of type 'void *' on success, + * NULL in case of error. Has to be freed manually. + **/ void *scaler_alloc(size_t elem_size, size_t size) { - return calloc(elem_size, size); + void *ptr = calloc(elem_size, size); + if (!ptr) + return NULL; + return ptr; } +/** + * scaler_free: + * @ptr : pointer to scaler object. + * + * Frees a scaler object. + **/ void scaler_free(void *ptr) { - free(ptr); + if (ptr) + free(ptr); } static bool allocate_frames(struct scaler_ctx *ctx)