aboutsummaryrefslogtreecommitdiff
path: root/sort.c
diff options
context:
space:
mode:
Diffstat (limited to 'sort.c')
-rw-r--r--sort.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/sort.c b/sort.c
index 6af5c4df3..a74f96ad0 100644
--- a/sort.c
+++ b/sort.c
@@ -64,7 +64,7 @@ static const int max = 1024;
64static Line *line_alloc() 64static Line *line_alloc()
65{ 65{
66 Line *self; 66 Line *self;
67 self = malloc(1 * sizeof(Line)); 67 self = xmalloc(1 * sizeof(Line));
68 return self; 68 return self;
69} 69}
70 70
@@ -76,9 +76,6 @@ static Line *line_newFromFile(FILE * src)
76 76
77 if ((cstring = get_line_from_file(src))) { 77 if ((cstring = get_line_from_file(src))) {
78 self = line_alloc(); 78 self = line_alloc();
79 if (self == NULL) {
80 return NULL;
81 }
82 self->data = cstring; 79 self->data = cstring;
83 self->next = NULL; 80 self->next = NULL;
84 return self; 81 return self;
@@ -173,10 +170,7 @@ static List *list_sort(List * self, Compare * compare)
173 Line *line; 170 Line *line;
174 171
175 /* mallocate array of Line*s */ 172 /* mallocate array of Line*s */
176 self->sorted = (Line **) malloc(self->len * sizeof(Line *)); 173 self->sorted = (Line **) xmalloc(self->len * sizeof(Line *));
177 if (self->sorted == NULL) {
178 return NULL;
179 }
180 174
181 /* fill array w/ List's contents */ 175 /* fill array w/ List's contents */
182 i = 0; 176 i = 0;
@@ -294,4 +288,4 @@ int sort_main(int argc, char **argv)
294 return(0); 288 return(0);
295} 289}
296 290
297/* $Id: sort.c,v 1.20 2000/07/16 20:57:15 kraai Exp $ */ 291/* $Id: sort.c,v 1.21 2000/09/13 02:46:13 kraai Exp $ */