Skip to content

Commit

Permalink
Removed unused variables to make gcc 4.7 happy, patch provided by Mak…
Browse files Browse the repository at this point in the history
…oto Fujiwara
  • Loading branch information
iMilnb committed Jun 16, 2013
1 parent 4b5f598 commit 5cd8e22
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 28 deletions.
13 changes: 7 additions & 6 deletions download.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
Expand Down Expand Up @@ -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)
Expand All @@ -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();
Expand Down
65 changes: 43 additions & 22 deletions pkg_check.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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,
Expand All @@ -67,24 +70,29 @@ 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;
}
/* 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) {
Expand All @@ -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 */
Expand All @@ -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;
}
Expand Down

0 comments on commit 5cd8e22

Please sign in to comment.