|
| iMatix home page | << | < | > | >> |
SFLVersion 2.11 |
#include "sfldir.h" int free_dir (DIRST *dir)
Frees all strings used in the DIRST. You should call this function to free space allocated by fix dir(). If you try to call free dir() for a DIRST that was not fixed, you will get an error feedback, and (if you compiled with DEBUG defined) an assertion fault. Returns 0 if okay, -1 if there was an error. After a call to free dir(), do not try to access the strings in DIRST; they are all set to point to an empty string.
{
static char
*empty = "";
ASSERT (dir-> _fixed);
if (dir-> _fixed)
{
/* Free allocated strings */
mem_free (dir-> owner);
mem_free (dir-> group);
mem_free (dir-> file_name);
/* Now point the strings to an empty string */
dir-> owner = empty;
dir-> group = empty;
dir-> file_name = empty;
/* And mark the DIRST as no longer 'fixed' */
dir-> _fixed = FALSE;
return (0);
}
else
return (-1);
}
| | << | < | > | >> |
|