diff options
author | Dan McGee <dan@archlinux.org> | 2011-06-16 20:15:11 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-06-22 19:31:12 +0200 |
commit | 54ef162a1a9e27e362732d873f0739bc0a2cf1bf (patch) | |
tree | e4ec6ba0ab94965c754a40d52a680f9fd69c4e37 /lib/libalpm/be_local.c | |
parent | 886a31ef205923fd5b29012ee75932a2e2dec4bd (diff) | |
download | pacman-54ef162a1a9e27e362732d873f0739bc0a2cf1bf.tar.gz pacman-54ef162a1a9e27e362732d873f0739bc0a2cf1bf.tar.xz |
Convert backup list to new pmbackup_t type
This allows us to separate the name and hash elements in one place and
not scatter different parsing code all over the place, including both
the frontend and backend.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/be_local.c')
-rw-r--r-- | lib/libalpm/be_local.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c index ee28db5a..4b2a3017 100644 --- a/lib/libalpm/be_local.c +++ b/lib/libalpm/be_local.c @@ -625,9 +625,12 @@ int _alpm_local_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq) } } else if(strcmp(line, "%BACKUP%") == 0) { while(fgets(line, sizeof(line), fp) && strlen(_alpm_strtrim(line))) { - char *linedup; - STRDUP(linedup, line, goto error); - info->backup = alpm_list_add(info->backup, linedup); + pmbackup_t *backup; + CALLOC(backup, 1, sizeof(pmbackup_t), goto error); + if(_alpm_split_backup(line, &backup)) { + goto error; + } + info->backup = alpm_list_add(info->backup, backup); } } } @@ -826,7 +829,8 @@ int _alpm_local_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq) if(info->backup) { fprintf(fp, "%%BACKUP%%\n"); for(lp = info->backup; lp; lp = lp->next) { - fprintf(fp, "%s\n", (char *)lp->data); + pmbackup_t *backup = lp->data; + fprintf(fp, "%s\t%s\n", backup->name, backup->hash); } fprintf(fp, "\n"); } |