summaryrefslogtreecommitdiff
path: root/lib/libalpm/be_package.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-12-29 18:43:44 -0600
committerDan McGee <dan@archlinux.org>2010-12-29 18:43:44 -0600
commita58083459b096e935693d94b9cb51a447b3a1abd (patch)
treee21857a8cc0b3dbe562cfe015571280c41023729 /lib/libalpm/be_package.c
parent126f50ab0b5ee3ed46c5a6ecae241e8af49b0fe2 (diff)
parente3c19569cfe7cd77674490b30624e71512417e0b (diff)
downloadpacman-a58083459b096e935693d94b9cb51a447b3a1abd.tar.xz
Merge branch 'fgets-perf'
Diffstat (limited to 'lib/libalpm/be_package.c')
-rw-r--r--lib/libalpm/be_package.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c
index f9f18d38..df5b28d1 100644
--- a/lib/libalpm/be_package.c
+++ b/lib/libalpm/be_package.c
@@ -155,17 +155,22 @@ static struct pkg_operations *get_file_pkg_ops(void)
*/
static int parse_descfile(struct archive *a, pmpkg_t *newpkg)
{
- char line[PATH_MAX];
char *ptr = NULL;
char *key = NULL;
int linenum = 0;
+ struct archive_read_buffer buf;
ALPM_LOG_FUNC;
- /* loop until we reach EOF (where archive_fgets will return NULL) */
- while(_alpm_archive_fgets(line, PATH_MAX, a) != NULL) {
+ memset(&buf, 0, sizeof(buf));
+ /* 512K for a line length seems reasonable */
+ buf.max_line_size = 512 * 1024;
+
+ /* loop until we reach EOF or other error */
+ while(_alpm_archive_fgets(a, &buf) == ARCHIVE_OK) {
+ char *line = _alpm_strtrim(buf.line);
+
linenum++;
- _alpm_strtrim(line);
if(strlen(line) == 0 || line[0] == '#') {
continue;
}