From f9956b9524ddafdb9d0cec042213eaa8229aad8c Mon Sep 17 00:00:00 2001 From: Chris Hall Date: Tue, 29 Mar 2011 01:49:16 +0100 Subject: Bring "ex" version up to date with 0.99.18 Release: 0.99.18ex15p -- Pipework Branch Also fixes issue with unknown attributes -- does not release them prematurely. Contains the "bgpd: New show commands for improved view and address family support", which is post 0.99.18. (But not RFC 5082 GTSM.) --- lib/memory.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'lib/memory.c') diff --git a/lib/memory.c b/lib/memory.c index d96ff21d..10e107a3 100644 --- a/lib/memory.c +++ b/lib/memory.c @@ -115,6 +115,12 @@ zerror (const char *fname, int type, size_t size) /*------------------------------------------------------------------------------ * Memory allocation. + * + * Allocate memory of a given size, to be tracked by a given type. + * + * Returns: pointer to usable memory. + * + * NB: If memory cannot be allocated, aborts execution. */ void * zmalloc (enum MTYPE mtype, size_t size MEMORY_TRACKER_NAME) @@ -173,7 +179,15 @@ zcalloc (enum MTYPE mtype, size_t size MEMORY_TRACKER_NAME) /*------------------------------------------------------------------------------ * Memory reallocation. * - * NB: just like real realloc(), is same as malloc() if ptr == NULL. + * Given a pointer returned by zmalloc()/zcalloc()/zrealloc(), extend or + * contract the allocation to the given size -- retaining current type. + * The type given MUST be the original type. + * + * Given a NULL, allocate memory as zmalloc(). + * + * Returns: pointer to usable memory. + * + * NB: If memory cannot be allocated, aborts execution. */ void * zrealloc (enum MTYPE mtype, void *ptr, size_t size MEMORY_TRACKER_NAME) @@ -203,7 +217,10 @@ zrealloc (enum MTYPE mtype, void *ptr, size_t size MEMORY_TRACKER_NAME) /*------------------------------------------------------------------------------ * Memory free. * - * NB: just like real free(), does nothing if ptr == NULL. + * Free memory allocated by zmalloc()/zcalloc()/zrealloc()/zstrdup(). + * The type given MUST be the original type. + * + * Does nothing if the given pointer is NULL. */ void zfree (enum MTYPE mtype, void *ptr) @@ -226,6 +243,10 @@ zfree (enum MTYPE mtype, void *ptr) /*------------------------------------------------------------------------------ * String duplication. + * + * Memory is allocated as zmalloc() and must later be freed by zfree(). + * + * NB: If memory cannot be allocated, aborts execution. */ char * zstrdup (enum MTYPE mtype, const char *str MEMORY_TRACKER_NAME) -- cgit v1.2.3