diff options
author | Dan McGee <dan@archlinux.org> | 2011-07-03 20:07:19 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-07-03 20:07:19 +0200 |
commit | de8b9a85a571716926e6b0f1a680fbb1d1cc8e94 (patch) | |
tree | e459e1eb4fef7604add864b75de8fcb23c500dd5 /lib | |
parent | cf1401a04d5179c89af6460b812e171cc2da19f0 (diff) | |
download | pacman-de8b9a85a571716926e6b0f1a680fbb1d1cc8e94.tar.gz pacman-de8b9a85a571716926e6b0f1a680fbb1d1cc8e94.tar.xz |
be_sync: make READ_NEXT() a no-arg macro
We passed in 'line', but not 'buf.line'. In addition, the macros
building off of READ_NEXT() assume variable names anyway. Since we only
use these macros in one function, might as well simplify them.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libalpm/be_sync.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c index ce418d56..cf12ef7a 100644 --- a/lib/libalpm/be_sync.c +++ b/lib/libalpm/be_sync.c @@ -433,19 +433,19 @@ static int sync_db_populate(alpm_db_t *db) return count; } -#define READ_NEXT(s) do { \ +#define READ_NEXT() do { \ if(_alpm_archive_fgets(archive, &buf) != ARCHIVE_OK) goto error; \ - s = _alpm_strtrim(buf.line); \ + line = _alpm_strtrim(buf.line); \ } while(0) #define READ_AND_STORE(f) do { \ - READ_NEXT(line); \ + READ_NEXT(); \ STRDUP(f, line, goto error); \ } while(0) #define READ_AND_STORE_ALL(f) do { \ char *linedup; \ - READ_NEXT(line); \ + READ_NEXT(); \ if(strlen(line) == 0) break; \ STRDUP(linedup, line, goto error); \ f = alpm_list_add(f, linedup); \ @@ -488,13 +488,13 @@ static int sync_db_read(alpm_db_t *db, struct archive *archive, char *line = _alpm_strtrim(buf.line); if(strcmp(line, "%NAME%") == 0) { - READ_NEXT(line); + READ_NEXT(); if(strcmp(line, pkg->name) != 0) { _alpm_log(db->handle, PM_LOG_ERROR, _("%s database is inconsistent: name " "mismatch on package %s\n"), db->treename, pkg->name); } } else if(strcmp(line, "%VERSION%") == 0) { - READ_NEXT(line); + READ_NEXT(); if(strcmp(line, pkg->version) != 0) { _alpm_log(db->handle, PM_LOG_ERROR, _("%s database is inconsistent: version " "mismatch on package %s\n"), db->treename, pkg->name); @@ -512,7 +512,7 @@ static int sync_db_read(alpm_db_t *db, struct archive *archive, } else if(strcmp(line, "%ARCH%") == 0) { READ_AND_STORE(pkg->arch); } else if(strcmp(line, "%BUILDDATE%") == 0) { - READ_NEXT(line); + READ_NEXT(); pkg->builddate = _alpm_parsedate(line); } else if(strcmp(line, "%PACKAGER%") == 0) { READ_AND_STORE(pkg->packager); @@ -521,20 +521,20 @@ static int sync_db_read(alpm_db_t *db, struct archive *archive, * pkginfo_t struct. This can be done b/c CSIZE is currently only used * in sync databases, and SIZE is only used in local databases. */ - READ_NEXT(line); + READ_NEXT(); pkg->size = atol(line); /* also store this value to isize if isize is unset */ if(pkg->isize == 0) { pkg->isize = pkg->size; } } else if(strcmp(line, "%ISIZE%") == 0) { - READ_NEXT(line); + READ_NEXT(); pkg->isize = atol(line); } else if(strcmp(line, "%MD5SUM%") == 0) { READ_AND_STORE(pkg->md5sum); } else if(strcmp(line, "%SHA256SUM%") == 0) { /* we don't do anything with this value right now */ - READ_NEXT(line); + READ_NEXT(); } else if(strcmp(line, "%PGPSIG%") == 0) { READ_AND_STORE(pkg->base64_sig); } else if(strcmp(line, "%REPLACES%") == 0) { @@ -542,7 +542,7 @@ static int sync_db_read(alpm_db_t *db, struct archive *archive, } else if(strcmp(line, "%DEPENDS%") == 0) { /* Different than the rest because of the _alpm_splitdep call. */ while(1) { - READ_NEXT(line); + READ_NEXT(); if(strlen(line) == 0) break; pkg->depends = alpm_list_add(pkg->depends, _alpm_splitdep(line)); } @@ -555,7 +555,7 @@ static int sync_db_read(alpm_db_t *db, struct archive *archive, } else if(strcmp(line, "%DELTAS%") == 0) { /* Different than the rest because of the _alpm_delta_parse call. */ while(1) { - READ_NEXT(line); + READ_NEXT(); if(strlen(line) == 0) break; pkg->deltas = alpm_list_add(pkg->deltas, _alpm_delta_parse(line)); } |