- fixed a cut'n'paste bug with %REASON% entry
- factorized code between %SIZE% and %CSIZE% reading
This commit is contained in:
parent
85203ff675
commit
cdd81bf177
1 changed files with 2 additions and 9 deletions
|
@ -330,14 +330,7 @@ int db_read(pmdb_t *db, char *name, unsigned int inforeq, pmpkg_t *info)
|
||||||
}
|
}
|
||||||
_alpm_strtrim(tmp);
|
_alpm_strtrim(tmp);
|
||||||
info->reason = atol(tmp);
|
info->reason = atol(tmp);
|
||||||
} else if(!strcmp(line, "%SIZE%")) {
|
} else if(!strcmp(line, "%SIZE%") || !strcmp(line, "%CSIZE%")) {
|
||||||
char tmp[32];
|
|
||||||
if(fgets(tmp, sizeof(tmp), fp) == NULL) {
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
_alpm_strtrim(tmp);
|
|
||||||
info->size = atol(tmp);
|
|
||||||
} else if(!strcmp(line, "%CSIZE%")) {
|
|
||||||
/* NOTE: the CSIZE and SIZE fields both share the "size" field
|
/* NOTE: the CSIZE and SIZE fields both share the "size" field
|
||||||
* in the pkginfo_t struct. This can be done b/c CSIZE
|
* in the pkginfo_t struct. This can be done b/c CSIZE
|
||||||
* is currently only used in sync databases, and SIZE is
|
* is currently only used in sync databases, and SIZE is
|
||||||
|
@ -490,7 +483,7 @@ int db_write(pmdb_t *db, pmpkg_t *info, unsigned int inforeq)
|
||||||
fputs("%SIZE%\n", fp);
|
fputs("%SIZE%\n", fp);
|
||||||
fprintf(fp, "%ld\n\n", info->size);
|
fprintf(fp, "%ld\n\n", info->size);
|
||||||
fputs("%REASON%\n", fp);
|
fputs("%REASON%\n", fp);
|
||||||
fprintf(fp, "%ld\n\n", info->size);
|
fprintf(fp, "%ld\n\n", info->reason);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue