along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: rbl.c,v 1.1.2.8 2000/11/20 19:12:10 guus Exp $
+ $Id: rbl.c,v 1.1.2.9 2000/11/21 09:13:59 guus Exp $
*/
+#include "config.h"
+
#include <stdlib.h>
#include <xalloc.h>
#include "rbl.h"
+#include <system.h>
/* Allocate a new rbl node */
rbl_t *new_rbl()
/* Free a rbl node */
void free_rbl(rbl_t *rbl)
{
+ if(rbl->data && rbl->tree->delete)
+ rbl->tree->delete(rbl->data);
free(rbl);
}
for(rbl = tree->head; rbl; rbl = next)
{
next = rbl->next;
- tree->delete(rbl->data);
+ if(tree->delete)
+ tree->delete(rbl->data);
}
tree->top = NULL;
void *xmalloc_and_zero PARAMS ((size_t n));
void *xcalloc PARAMS ((size_t n, size_t s));
void *xrealloc PARAMS ((void *p, size_t n));
+
+char *xstrdup PARAMS ((char *s));
#include <sys/types.h>
#include <stdio.h>
+#include <string.h>
#if STDC_HEADERS
# include <stdlib.h>
return p;
}
+/* Duplicate a string */
+
+char *xstrdup(char *s)
+{
+ char *p;
+
+ p = strdup(s);
+ if(!p)
+ xalloc_fail ((int)strlen(s));
+ return p;
+}
+
#ifdef NOT_USED
/* Allocate memory for N elements of S bytes, with error checking. */