what you give them. Help stamp out software-hoarding!
-------------------------------------------------------------------------*/
-#include "common.h"
+#include <stdio.h>
+#include <malloc.h>
+#include <assert.h>
+#include "SDCCset.h"
/*-----------------------------------------------------------------*/
/* newSet - will allocate & return a new set entry */
{
set *lp ;
- ALLOC(lp,sizeof(set)) ;
+ lp = calloc(1, sizeof(set));
+ if (lp == 0) {
+ fprintf(stderr, "out of virtual memory: %s\n", __FILE__);
+ exit(1);
+ }
lp->item = lp->curr= lp->next = NULL;
return lp;
va_list ap;
int rvalue = 0 ;
- va_start(ap,somefunc);
- for (lp = list ; lp ; lp = lp->next )
- rvalue += (*somefunc)(lp->item,ap) ;
- va_end(ap);
+ for (lp = list ; lp ; lp = lp->next ) {
+ va_start(ap,somefunc);
+ rvalue += (*somefunc)(lp->item,ap) ;
+ va_end(ap);
+ }
return rvalue;
}
va_list ap;
int rvalue = 0 ;
- va_start(ap,somefunc);
- for (lp = list ; lp ; lp = lp->next )
- if (rvalue += (*somefunc)(lp->item,ap))
- break;
- va_end(ap);
+ for (lp = list ; lp ; lp = lp->next ) {
+ va_start(ap,somefunc);
+ rvalue += (*somefunc)(lp->item,ap);
+ va_end(ap);
+ if (rvalue)
+ break;
+ }
return rvalue;
}
if (! *item )
return ;
- GC_free(*item);
+ free(*item);
*item = NULL ;
}