aboutsummaryrefslogtreecommitdiff
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
parent3387538bbeab0540783c356b298ae45dfb3684a3 (diff)
downloadbusybox-w32-20273138fcd7b93a7743ea7fcbef775c5af2908c.tar.gz
busybox-w32-20273138fcd7b93a7743ea7fcbef775c5af2908c.tar.bz2
busybox-w32-20273138fcd7b93a7743ea7fcbef775c5af2908c.zip
dpkg: code shrink (by Peter Korsgaard <jacmet@uclibc.org>)
function old new delta create_list 104 86 -18
-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
1152static char **create_list(const char *filename) 1152static char **create_list(const char *filename)
1153{ 1153{
1154 FILE *list_stream; 1154 FILE *list_stream;
1155 char **file_list = NULL; 1155 char **file_list;
1156 char *line = NULL; 1156 char *line;
1157 int count = 0; 1157 int count;
1158 1158
1159 /* don't use [xw]fopen here, handle error ourself */ 1159 /* don't use [xw]fopen here, handle error ourself */
1160 list_stream = fopen(filename, "r"); 1160 list_stream = fopen(filename, "r");
@@ -1162,17 +1162,15 @@ static char **create_list(const char *filename)
1162 return NULL; 1162 return NULL;
1163 } 1163 }
1164 1164
1165 file_list = NULL;
1166 count = 0;
1165 while ((line = xmalloc_fgetline(list_stream)) != NULL) { 1167 while ((line = xmalloc_fgetline(list_stream)) != NULL) {
1166 file_list = xrealloc(file_list, sizeof(char *) * (count + 2)); 1168 file_list = xrealloc(file_list, sizeof(char *) * (count + 2));
1167 file_list[count] = line; 1169 file_list[count++] = line;
1168 count++; 1170 file_list[count] = NULL;
1169 } 1171 }
1170 fclose(list_stream); 1172 fclose(list_stream);
1171 1173
1172 if (count == 0) {
1173 return NULL;
1174 }
1175 file_list[count] = NULL;
1176 return file_list; 1174 return file_list;
1177} 1175}
1178 1176