From 5cd8e2264d6ec625e5bb3337a8a82174e75c9fad Mon Sep 17 00:00:00 2001 From: Emile 'iMil' Heitor Date: Sun, 16 Jun 2013 15:54:01 +0200 Subject: [PATCH] Removed unused variables to make gcc 4.7 happy, patch provided by Makoto Fujiwara --- download.c | 13 ++++++----- pkg_check.c | 65 +++++++++++++++++++++++++++++++++++------------------ 2 files changed, 50 insertions(+), 28 deletions(-) diff --git a/download.c b/download.c index 5906c59..aa5a26f 100644 --- a/download.c +++ b/download.c @@ -46,8 +46,7 @@ download_file(char *str_url, time_t *db_mtime) size_t buf_len, buf_fetched; ssize_t cur_fetched; off_t statsize; - time_t begin_dl, now; - struct url_stat st; + struct url_stat st; struct url *url; fetchIO *f = NULL; @@ -65,7 +64,10 @@ download_file(char *str_url, time_t *db_mtime) if (db_mtime != NULL) { if (st.mtime <= *db_mtime) { - /* -1 used to identify return type, local summary up-to-date */ + /* + * -1 used to identify return type, + * local summary up-to-date + */ *db_mtime = -1; fetchIO_close(f); @@ -96,13 +98,13 @@ download_file(char *str_url, time_t *db_mtime) fflush(stdout); buf_fetched = 0; - begin_dl = time(NULL); statsize = 0; start_progress_meter(p, buf_len, &statsize); while (buf_fetched < buf_len) { - cur_fetched = fetchIO_read(f, file->buf + buf_fetched, fetch_buffer); + cur_fetched = fetchIO_read(f, file->buf + buf_fetched, + fetch_buffer); if (cur_fetched == 0) errx(EXIT_FAILURE, "truncated file"); else if (cur_fetched == -1) @@ -111,7 +113,6 @@ download_file(char *str_url, time_t *db_mtime) buf_fetched += cur_fetched; statsize += cur_fetched; - now = time(NULL); } stop_progress_meter(); diff --git a/pkg_check.c b/pkg_check.c index 858a498..cc20e21 100644 --- a/pkg_check.c +++ b/pkg_check.c @@ -36,11 +36,12 @@ int pkg_met_reqs(Plisthead *impacthead) { - int met_reqs = 1, foundreq; + int met_reqs = 1; Pkglist *pimpact, *requires; Plistnumbered *requireshead = NULL; struct stat sb; #ifdef CHECK_PROVIDES + int foundreq; Pkglist *impactprov = NULL, *provides = NULL; Plistnumbered *l_provideshead = NULL, *r_provideshead = NULL; @@ -58,7 +59,9 @@ pkg_met_reqs(Plisthead *impacthead) /* parse requires list */ SLIST_FOREACH(requires, requireshead->P_Plisthead, next) { +#ifdef CHECK_PROVIDES foundreq = 0; +#endif /* for performance sake, first check basesys */ if ((strncmp(requires->full, LOCALBASE, @@ -67,7 +70,10 @@ pkg_met_reqs(Plisthead *impacthead) printf(MSG_REQT_NOT_PRESENT, requires->full, pimpact->full); - /* mark as DONOTHING, requirement missing */ + /* + * mark as DONOTHING, + * requirement missing + */ pimpact->action = UNMET_REQ; met_reqs = 0; @@ -75,16 +81,18 @@ pkg_met_reqs(Plisthead *impacthead) /* was a basysfile, no need to check PROVIDES */ continue; } - /* FIXME: the code below actually works, but there's no - * point losing performances when some REQUIRES do not match - * PROVIDES in pkg_summary(5). This is a known issue and will - * hopefuly be fixed. + /* + * FIXME: the code below actually works, but there's no + * point losing performances when some REQUIRES do not + * match PROVIDES in pkg_summary(5). This is a known + * issue and will hopefuly be fixed. */ #ifndef CHECK_PROVIDES continue; #else /* search what local packages provide */ - SLIST_FOREACH(provides, l_provideshead->P_Plisthead, next) { + SLIST_FOREACH(provides, l_provideshead->P_Plisthead, + next) { if (strncmp(provides->full, requires->full, strlen(requires->full)) == 0) { @@ -96,32 +104,43 @@ pkg_met_reqs(Plisthead *impacthead) } /* match */ } /* SLIST_FOREACH LOCAL_PROVIDES */ - /* REQUIRES was not found on local packages, try impact list */ + /* + * REQUIRES was not found on local packages, + * try impact list + */ if (!foundreq) { /* re-parse impact list to retreive PROVIDES */ SLIST_FOREACH(impactprov, impacthead, next) { if ((r_provideshead = - rec_pkglist(GET_PROVIDES_QUERY, - impactprov->full)) == NULL) + rec_pkglist(GET_PROVIDES_QUERY, + impactprov->full)) == NULL) continue; - /* then parse provides list for every package */ - SLIST_FOREACH(provides, r_provideshead->P_Plisthead, next) { + /* + * then parse provides list for + * every package + */ + SLIST_FOREACH(provides, + r_provideshead->P_Plisthead, next) { if (strncmp(provides->full, - requires->full, - strlen(requires->full)) == 0) { + requires->full, + strlen(requires->full)) == 0) { foundreq = 1; - /* found, no need to go further - return to impactprov list */ + /* + * found, no need to + * go further return + * to impactprov list + */ break; } /* match */ } free_pkglist(&r_provideshead->P_Plisthead, LIST); free(r_provideshead); - if (foundreq) /* exit impactprov list loop */ + if (foundreq) + /* exit impactprov list loop */ break; } /* SLIST_NEXT impactprov */ @@ -130,13 +149,15 @@ pkg_met_reqs(Plisthead *impacthead) /* FIXME: BIG FAT DISCLAIMER * as of 04/2009, some packages described in pkg_summary - * have unmet REQUIRES. This is a known bug that makes the - * PROVIDES untrustable and some packages uninstallable. - * foundreq is forced to 1 for now for every REQUIRES - * matching LOCALBASE, which is hardcoded to "/usr/pkg" + * have unmet REQUIRES. This is a known bug that makes + * the PROVIDES untrustable and some packages + * uninstallable. foundreq is forced to 1 for now for + * every REQUIRES matching LOCALBASE, which is hardcoded + * to "/usr/pkg" */ if (!foundreq) { - printf(MSG_REQT_NOT_PRESENT_DEPS, requires->full); + printf(MSG_REQT_NOT_PRESENT_DEPS, + requires->full); foundreq = 1; }