-------------------------------------------------------------------------*/
#include <stdio.h>
-#if defined(__APPLE__) && defined(__MACH__)
-#include <sys/malloc.h>
-#else
-#include <malloc.h>
-#endif
#include "newalloc.h"
#include <assert.h>
#include "SDCCset.h"
{
set *lp;
- lp = Safe_calloc (1, sizeof (set));
+ lp = Safe_alloc ( sizeof (set));
// if (lp == 0) {
// fprintf(stderr, "out of virtual memory: %s\n", __FILE__);
// exit(1);
return count;
}
+/*-----------------------------------------------------------------*/
+/* reverseSet - reverse the order of the items of a set */
+/*-----------------------------------------------------------------*/
+
+set *
+reverseSet(set * s)
+{
+ set *t = NULL;
+ set *u = NULL;
+
+ while(s->next) {
+ t = s->next;
+ s->next = u;
+ u = s;
+ s = t;
+ }
+ s->next = u;
+ return s;
+}
+
/*-----------------------------------------------------------------*/
/* subtractFromSet - take away from set1 elements of set2 */
/*-----------------------------------------------------------------*/
if (!*item)
return;
- free (*item);
+ Safe_free (*item);
*item = NULL;
}