Introduction
@defgroup util Memory Utility Routines
@ingroup library
@{
#defines
#define SNMP_FREE(
s) do {
if (
s) {
free((
void *)s); s=NULL; }
} while(
0)
Discussion
@def SNMP_FREE(s)
Frees a pointer only if it is !NULL and sets its value to NULL
#define SNMP_MALLOC_STRUCT(
s)
Discussion
@def SNMP_MALLOC_STRUCT(s)
Mallocs memory of sizeof(struct s), zeros it and returns a pointer to it.
#define SNMP_MALLOC_TYPEDEF(
td)
Discussion
@def SNMP_MALLOC_TYPEDEF(t)
Mallocs memory of sizeof(t), zeros it and returns a pointer to it.
#define SNMP_MAX(
a,b)
Discussion
@def SNMP_MAX(a, b)
Computers the maximum of a and b.
#define SNMP_MIN(
a,b)
Discussion
@def SNMP_MIN(a, b)
Computers the minimum of a and b.
#define SNMP_SWIPE_MEM(
n,s) do {
if (
n) free((
void *)n); n = s; s=NULL;
} while(
0)
Discussion
@def SNMP_SWIPE_MEM(n, s)
Frees pointer n only if it is !NULL, sets n to s and sets s to NULL
#define SNMP_ZERO(
s,l) do {
if (
s) memset(
s, 0, l);
} while(
0)
Discussion
@def SNMP_ZERO(s,l)
Zeros l bytes of memory starting at s.
|
Did this document help you? |
Yes: Tell us what works for you.
|
|
Last Updated: 2006-06-20