bug 568948: building with latest MSVC
[fw/sdcc] / src / SDCCset.c
index 61b68a05931d5364ba28ee3ae7131897fd0edd46..3007157c73afe0d68e42207bd8442f275929fec6 100644 (file)
@@ -31,7 +31,7 @@
 /* newSet - will allocate & return a new set entry             */
 /*-----------------------------------------------------------------*/
 set *
-newSet ()
+newSet (void)
 {
   set *lp;
 
@@ -576,3 +576,30 @@ setToNull (void **item)
   Safe_free (*item);
   *item = NULL;
 }
+
+/*-----------------------------------------------------------------*/
+/* deleteSet - will throw away the entire list                     */
+/*  note - setToNull doesn't actually throw away the whole list.   */
+/*         Instead it only throws away the first item.             */
+/*-----------------------------------------------------------------*/
+void deleteSet(set **s)
+{
+  set *curr;
+  set *next;
+
+  if(!s || !*s)
+    return;
+
+  curr = *s;
+  next = curr->next;
+  while (next) {
+    Safe_free (curr);
+    curr = next;
+    next = next->next;
+  }
+
+  Safe_free (curr);
+
+  *s = NULL;
+}
+