X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2FSDCCset.c;fp=src%2FSDCCset.c;h=3007157c73afe0d68e42207bd8442f275929fec6;hb=c2cb349ed277ff586c5613f3addf6ff8307d61bd;hp=19babd6edbef3f32915d752ac77b8a1f6cc120e0;hpb=3933e81dce0294a133bee29f0d1d329dbd1365e1;p=fw%2Fsdcc diff --git a/src/SDCCset.c b/src/SDCCset.c index 19babd6e..3007157c 100644 --- a/src/SDCCset.c +++ b/src/SDCCset.c @@ -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; +} +