diff options
author | David Sommerseth <dazo@users.sourceforge.net> | 2009-09-07 22:53:21 +0200 |
---|---|---|
committer | David Sommerseth <dazo@users.sourceforge.net> | 2009-09-07 22:53:21 +0200 |
commit | 55f75cd2678f249c5503109798a69fbbc01936af (patch) | |
tree | cc6ed3e16a661ad3d2f68888dd94672580aec6e7 /common | |
parent | 2e1851802188515f8edeed8eb3f753cf69e348d9 (diff) | |
download | eurephia-55f75cd2678f249c5503109798a69fbbc01936af.tar.gz eurephia-55f75cd2678f249c5503109798a69fbbc01936af.tar.xz eurephia-55f75cd2678f249c5503109798a69fbbc01936af.zip |
Fixed comments to malloc_nullsafe() and free_nullsafe()
Diffstat (limited to 'common')
-rw-r--r-- | common/eurephia_nullsafe.c | 16 | ||||
-rw-r--r-- | common/eurephia_nullsafe.h | 11 |
2 files changed, 20 insertions, 7 deletions
diff --git a/common/eurephia_nullsafe.c b/common/eurephia_nullsafe.c index bcca178..bd78d6b 100644 --- a/common/eurephia_nullsafe.c +++ b/common/eurephia_nullsafe.c @@ -39,7 +39,10 @@ #include <eurephia_log.h> /** - * Internal function, called via the malloc_nullsafe() macro. + * Internal function, should be called via the malloc_nullsafe() macro. + * This replaces the use of malloc() and memset(). This function uses calloc + * internally, which results in the memory region being zero'd by the kernel + * on memory allocation. * * @param ctx eurephiaCTX, used for logging * @param sz size of the memory region being allocated @@ -69,6 +72,17 @@ void *__malloc_nullsafe(eurephiaCTX *ctx, size_t sz, const char *file, int line) return buf; } + +/** + * Internal function for freeing memory. Also does some logging of the freeing if debug level + * enabled and log level high enough. Should be called via the free_nullsafe() macro. + * + * @param ctx eurephiaCTX (for logging only) + * @param ptr Pointer to the memory region to be freed + * @param file debug info, which file is doing this call + * @param line debug info, which line in the file + * + */ void inline __free_nullsafe(eurephiaCTX *ctx, void *ptr, const char *file, int line) { if( ptr == NULL ) { return; diff --git a/common/eurephia_nullsafe.h b/common/eurephia_nullsafe.h index 70c09d3..5f6b58c 100644 --- a/common/eurephia_nullsafe.h +++ b/common/eurephia_nullsafe.h @@ -72,14 +72,13 @@ void *__malloc_nullsafe(eurephiaCTX *, size_t, const char *, int); /** - * calloc() wrapper. Should replace the use of malloc() and memset(). This - * function uses calloc internally, which results in the memory region being zero'd - * by the kernel on allocation. + * Front-end macro for the __malloc_nullsafe() function. * * @param ctx eurephiaCTX (used for debugg logging) - * @param size Size of the memory region wanted + * @param sz Size of the memory region wanted * * @return Returns a pointer to the memory region on success, otherwise NULL. + * */ #define malloc_nullsafe(ctx, sz) __malloc_nullsafe(ctx, sz, __FILE__, __LINE__) @@ -87,9 +86,9 @@ void *__malloc_nullsafe(eurephiaCTX *, size_t, const char *, int); void inline __free_nullsafe(eurephiaCTX *ctx, void *ptr, const char *file, int line); /** - * free() wrapper. Frees memory allocated by malloc() or calloc(). It also sets the - * input pointer to NULL on success. + * Front-end macro for the __free_nullsafe() function. * + * @param ctx eurephiaCTX (used for debugg logging) * @param ptr Pointer to the memory region being freed. * */ |