diff options
author | Chris Hall <chris.hall@highwayman.com> | 2011-03-29 01:49:16 +0100 |
---|---|---|
committer | Chris Hall <chris.hall@highwayman.com> | 2011-03-29 01:49:16 +0100 |
commit | f9956b9524ddafdb9d0cec042213eaa8229aad8c (patch) | |
tree | bf362c892837ef3f5a6a4d4265eb18e1b47ccf33 /lib/memory.c | |
parent | 9470cb2c32eab220f796b1438b787528272cbe84 (diff) | |
download | quagga-ex15p.tar.bz2 quagga-ex15p.tar.xz |
Bring "ex" version up to date with 0.99.18ex15p
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.)
Diffstat (limited to 'lib/memory.c')
-rw-r--r-- | lib/memory.c | 25 |
1 files changed, 23 insertions, 2 deletions
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) |