| iMatix home page
| << | < | > | >>
SFL Logo SFL
Version 2.11

 

mem_strfree_

#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    */
)

Synopsis

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.

Examples

    char
        *string1 = NULL,
        *string2 = NULL;
    string1 = mem_strdup ("This is a string");
    mem_strfree (&string1);
    mem_strfree (&string2);

Source Code - (sflmem.c)

{
    ASSERT (string);
    if (*string)
      {
        mem free  (*string, filename, lineno);
        *string = NULL;
      }
}

| << | < | > | >> iMatix Copyright © 1996-2000 iMatix Corporation