Repositories » libk0
Clone URL:  
Pushed to one repository · View In Graph Contained in tip

klist's freelist has an option to shallow-free the list if a NULL is
passed in stead of a pointer to a function that can free a Node's

data.

Changeset 3cf5d2bdac57

Parent 0b22612dc261

by Rup Palchowdhury

Changes to 2 files · Browse files at 3cf5d2bdac57 Showing diff from parent 0b22612dc261 Diff from another changeset...

Change 1 of 1 Show Entire File klist.c Stacked
 
70
71
72
73
 
 
 
 
74
75
76
 
70
71
72
 
73
74
75
76
77
78
79
@@ -70,7 +70,10 @@
  Node *next;   for (; p != NULL; p = next) {   next = p->next; - freenode(p, freedata); + if (freedata == NULL) + free(p); + else + freenode(p, freedata);   }  }  
Change 1 of 3 Show Entire File test.c Stacked
 
17
18
19
20
 
21
22
23
 
50
51
52
53
 
54
55
56
 
57
58
59
 
72
73
74
 
75
76
77
 
17
18
19
 
20
21
22
23
 
50
51
52
 
53
54
55
 
56
57
58
59
 
72
73
74
75
76
77
78
@@ -17,7 +17,7 @@
  Post *pp;     /* hash table test */ - /* +   const int NHASH = 3;   Node *htab[NHASH];   for (i = 0; i < NHASH; i++) @@ -50,10 +50,10 @@
  }   else   printf("Not found\n"); - */ +     /* tree test */ - + /*   TNode *found;   t = NULL;   for (i = 0; i < NUMNODES; i++) @@ -72,6 +72,7 @@
  printf("\n");   printf("postorder:\n");   applypostorder(t, printpost, "%s %d\n"); + */     /* list test */