Minor code cleanups
Mostly noticed when compiling libalpm/pacman with ICC. Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
2890114600
commit
f7192b5958
|
@ -51,7 +51,7 @@
|
|||
* Return the last update time as number of seconds from the epoch.
|
||||
* Returns 0 if the value is unknown or can't be read.
|
||||
*/
|
||||
time_t getlastupdate(const pmdb_t *db)
|
||||
static time_t getlastupdate(const pmdb_t *db)
|
||||
{
|
||||
FILE *fp;
|
||||
char *file;
|
||||
|
@ -85,7 +85,7 @@ time_t getlastupdate(const pmdb_t *db)
|
|||
/*
|
||||
* writes the dbpath/.lastupdate file with the value in time
|
||||
*/
|
||||
int setlastupdate(const pmdb_t *db, time_t time)
|
||||
static int setlastupdate(const pmdb_t *db, time_t time)
|
||||
{
|
||||
FILE *fp;
|
||||
char *file;
|
||||
|
@ -500,7 +500,7 @@ int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
|
|||
if(fgets(line, 512, fp) == NULL) {
|
||||
goto error;
|
||||
}
|
||||
info->reason = atol(_alpm_strtrim(line));
|
||||
info->reason = (pmpkgreason_t)atol(_alpm_strtrim(line));
|
||||
} else if(strcmp(line, "%SIZE%") == 0 || strcmp(line, "%CSIZE%") == 0) {
|
||||
/* NOTE: the CSIZE and SIZE fields both share the "size" field
|
||||
* in the pkginfo_t struct. This can be done b/c CSIZE
|
||||
|
|
|
@ -111,11 +111,11 @@ static int download_internal(const char *url, const char *localpath,
|
|||
FILE *dlf, *localf = NULL;
|
||||
struct url_stat ust;
|
||||
struct stat st;
|
||||
int chk_resume = 0;
|
||||
size_t dl_thisfile = 0;
|
||||
int chk_resume = 0, ret = 0;
|
||||
size_t dl_thisfile = 0, nread = 0;
|
||||
char *tempfile, *destfile, *filename;
|
||||
int ret = 0;
|
||||
struct url *fileurl = url_for_string(url);
|
||||
char buffer[PM_DLBUF_LEN];
|
||||
|
||||
if(!fileurl) {
|
||||
return(-1);
|
||||
|
@ -200,9 +200,8 @@ static int download_internal(const char *url, const char *localpath,
|
|||
handle->dlcb(filename, 0, ust.size);
|
||||
}
|
||||
|
||||
size_t nread = 0;
|
||||
char buffer[PM_DLBUF_LEN];
|
||||
while((nread = fread(buffer, 1, PM_DLBUF_LEN, dlf)) > 0) {
|
||||
size_t nwritten = 0;
|
||||
if(ferror(dlf)) {
|
||||
pm_errno = PM_ERR_LIBDOWNLOAD;
|
||||
_alpm_log(PM_LOG_ERROR, _("error downloading '%s': %s\n"),
|
||||
|
@ -211,7 +210,6 @@ static int download_internal(const char *url, const char *localpath,
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
size_t nwritten = 0;
|
||||
while(nwritten < nread) {
|
||||
nwritten += fwrite(buffer, 1, (nread - nwritten), localf);
|
||||
if(ferror(localf)) {
|
||||
|
|
|
@ -551,6 +551,7 @@ static int sync_trans(alpm_list_t *targets)
|
|||
int retval = 0;
|
||||
alpm_list_t *data = NULL;
|
||||
alpm_list_t *sync_dbs = alpm_option_get_syncdbs();
|
||||
alpm_list_t *packages = NULL;
|
||||
|
||||
/* Step 1: create a new transaction... */
|
||||
if(trans_init(PM_TRANS_TYPE_SYNC, config->flags) == -1) {
|
||||
|
@ -659,7 +660,7 @@ static int sync_trans(alpm_list_t *targets)
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
alpm_list_t *packages = alpm_trans_get_pkgs();
|
||||
packages = alpm_trans_get_pkgs();
|
||||
if(packages == NULL) {
|
||||
/* nothing to do: just exit without complaining */
|
||||
printf(_(" local database is up to date\n"));
|
||||
|
|
Loading…
Reference in New Issue