aboutsummaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-06-21 22:10:52 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-06-21 22:10:52 +0000
commit20273138fcd7b93a7743ea7fcbef775c5af2908c (patch)
tree5df2bc08e646251e408bdd244f061ec506ee01c6 /archival
parent3387538bbeab0540783c356b298ae45dfb3684a3 (diff)
downloadbusybox-20273138fcd7b93a7743ea7fcbef775c5af2908c.tar.gz
dpkg: code shrink (by Peter Korsgaard <jacmet@uclibc.org>)
function old new delta create_list 104 86 -18
Diffstat (limited to 'archival')
-rw-r--r--archival/dpkg.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/archival/dpkg.c b/archival/dpkg.c
index c8ea0b34e..0b473b05b 100644
--- a/archival/dpkg.c
+++ b/archival/dpkg.c
@@ -1152,9 +1152,9 @@ static int check_deps(deb_file_t **deb_file, int deb_start /*, int dep_max_count
static char **create_list(const char *filename)
{
FILE *list_stream;
- char **file_list = NULL;
- char *line = NULL;
- int count = 0;
+ char **file_list;
+ char *line;
+ int count;
/* don't use [xw]fopen here, handle error ourself */
list_stream = fopen(filename, "r");
@@ -1162,17 +1162,15 @@ static char **create_list(const char *filename)
return NULL;
}
+ file_list = NULL;
+ count = 0;
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;
}