From 95492ec0431fe8a722f451aee714e35478cf90b8 Mon Sep 17 00:00:00 2001 From: Peter Korsgaard Date: Thu, 5 Jun 2008 13:28:24 +0200 Subject: [PATCH] dpkg: create_list: zero terminate list in loop Saves a few bytes: function old new delta create_list 124 103 -21 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-21) Total: -21 bytes --- archival/dpkg.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-) diff --git a/archival/dpkg.c b/archival/dpkg.c index 1280ca0..5bc64d5 100644 --- a/archival/dpkg.c +++ b/archival/dpkg.c @@ -1164,15 +1164,11 @@ static char **create_list(const char *filename) while ((line = xmalloc_fgetline(list_stream)) != NULL) { file_list = xrealloc(file_list, sizeof(char *) * (count + 2)); - file_list[count] = line; - count++; + file_list[count++] = line; + file_list[count] = NULL; } fclose(list_stream); - if (count == 0) { - return NULL; - } - file_list[count] = NULL; return file_list; } -- 1.5.5.1