diff options
author | Chris Hall <chris.hall@highwayman.com> | 2011-03-29 00:29:35 +0100 |
---|---|---|
committer | Chris Hall <chris.hall@highwayman.com> | 2011-03-29 00:29:35 +0100 |
commit | e20f7ccd9e110fcd5deb945f8d23922efd8b0822 (patch) | |
tree | 89b61ee61ac306817dc19b9313806bf2562b1c1b /lib/memory.c | |
parent | 6481583be322b0ba223a0140500a0a6d50546dd9 (diff) | |
download | quagga-ex14.tar.bz2 quagga-ex14.tar.xz |
Bring "ex" version up to date with 0.99.18ex14
Release: 0.99.18ex14
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 | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/memory.c b/lib/memory.c index c13404d2..49b20c14 100644 --- a/lib/memory.c +++ b/lib/memory.c @@ -112,6 +112,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) @@ -141,6 +147,8 @@ zmalloc (enum MTYPE mtype, size_t size MEMORY_TRACKER_NAME) /*------------------------------------------------------------------------------ * Memory allocation zeroising the allocated area. + * + * As zmalloc, plus zeroises the allocated memory. */ void * zcalloc (enum MTYPE mtype, size_t size MEMORY_TRACKER_NAME) @@ -170,6 +178,16 @@ zcalloc (enum MTYPE mtype, size_t size MEMORY_TRACKER_NAME) /*------------------------------------------------------------------------------ * Memory reallocation. + * + * 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) @@ -199,6 +217,11 @@ zrealloc (enum MTYPE mtype, void *ptr, size_t size MEMORY_TRACKER_NAME) /*------------------------------------------------------------------------------ * Memory free. + * + * 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) @@ -222,6 +245,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) |