|
| iMatix home page | << | < | > | >> |
SFLVersion 2.11 |
#include "sflmem.h"
void
mem_strfree_ (
char **string, /* Address of string to free */
const char *filename, /* Name of source file making call */
size_t lineno /* Line number in calling source */
)
Releases memory occupied by a string. Use the mem_strfree() macro to call this function! Call this function to free strings allocated using mem strdup (). Accepts the address of a char pointer as argument: if the pointer is not null, the string is freed, and the pointer is set to null. Returns the address of the modified pointer.
char
*string1 = NULL,
*string2 = NULL;
string1 = mem_strdup ("This is a string");
mem_strfree (&string1);
mem_strfree (&string2);
{
ASSERT (string);
if (*string)
{
mem free (*string, filename, lineno);
*string = NULL;
}
}
| | << | < | > | >> |
|