summaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorJohn Beppu1999-12-22 17:57:31 +0000
committerJohn Beppu1999-12-22 17:57:31 +0000
commit019513a59ffd966cca51d6616757295a46869e4a (patch)
tree5d03c4e7c4ba676fef529c52a4a55c46e246259e /coreutils
parent38efa7902e7d266fbc78e1d39780ca0866d98dad (diff)
downloadbusybox-019513a59ffd966cca51d6616757295a46869e4a.zip
busybox-019513a59ffd966cca51d6616757295a46869e4a.tar.gz
added hooks for sort
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/sort.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/coreutils/sort.c b/coreutils/sort.c
index d823517..f3f9fca 100644
--- a/coreutils/sort.c
+++ b/coreutils/sort.c
@@ -90,6 +90,17 @@ line_newFromFile(FILE *src)
return NULL;
}
+/* Line destructor */
+static Line *
+line_release(Line *self)
+{
+ if (self->data) {
+ free(self->data);
+ free(self);
+ }
+ return self;
+}
+
/* Comparison */
@@ -148,7 +159,16 @@ list_writeToFile(List *self, FILE* dst)
static List *
list_release(List *self)
{
- return self;
+ Line *i;
+ Line *die;
+
+ i = self->head;
+ while (i) {
+ die = i;
+ i = die->next;
+ line_delete(die);
+ }
+ return self; /* bad poetry? */
}
@@ -195,4 +215,4 @@ sort_main(int argc, char **argv)
exit(0);
}
-/* $Id: sort.c,v 1.2 1999/12/22 00:30:29 beppu Exp $ */
+/* $Id: sort.c,v 1.3 1999/12/22 17:57:31 beppu Exp $ */