- fix: lclint fiddles broke uCache initialization (#43139).

CVS patchset: 4829
CVS date: 2001/06/01 22:00:07
This commit is contained in:
jbj 2001-06-01 22:00:07 +00:00
parent 3720e702da
commit 9e1929c9bb
2 changed files with 11 additions and 16 deletions

View File

@ -76,6 +76,7 @@
- fix: return suggested packages when using Depends cache. - fix: return suggested packages when using Depends cache.
- merge sparc64/ia64 fiddles back into linux.{req,prov}. - merge sparc64/ia64 fiddles back into linux.{req,prov}.
- automagically generate perl module dependencies always. - automagically generate perl module dependencies always.
- fix: lclint fiddles broke uCache initialization (#43139).
4.0 -> 4.0.[12] 4.0 -> 4.0.[12]
- add doxygen and lclint annotations most everywhere. - add doxygen and lclint annotations most everywhere.

View File

@ -171,23 +171,18 @@ static void urlFind(/*@null@*/ /*@in@*/ /*@out@*/ urlinfo *uret, int mustAsk)
{ {
urlinfo u; urlinfo u;
int ucx; int ucx;
int i; int i = 0;
if (uret == NULL) if (uret == NULL)
return; return;
if (uCache == NULL) {
*uret = NULL;
return;
}
u = *uret; u = *uret;
URLSANE(u); URLSANE(u);
ucx = -1; ucx = -1;
for (i = 0; i < uCount; i++) { for (i = 0; i < uCount; i++) {
urlinfo ou; urlinfo ou = NULL;
if ((ou = uCache[i]) == NULL) { if (uCache == NULL || (ou = uCache[i]) == NULL) {
if (ucx < 0) if (ucx < 0)
ucx = i; ucx = i;
continue; continue;
@ -211,12 +206,10 @@ static void urlFind(/*@null@*/ /*@in@*/ /*@out@*/ urlinfo *uret, int mustAsk)
if (i == uCount) { if (i == uCount) {
if (ucx < 0) { if (ucx < 0) {
ucx = uCount++; ucx = uCount++;
if (uCache) uCache = xrealloc(uCache, sizeof(*uCache) * uCount);
uCache = xrealloc(uCache, sizeof(*uCache) * uCount);
else
uCache = xmalloc(sizeof(*uCache));
} }
uCache[ucx] = urlLink(u, "uCache (miss)"); if (uCache) /* XXX always true */
uCache[ucx] = urlLink(u, "uCache (miss)");
u = urlFree(u, "urlSplit (urlFind miss)"); u = urlFree(u, "urlSplit (urlFind miss)");
} else { } else {
ucx = i; ucx = i;
@ -225,7 +218,8 @@ static void urlFind(/*@null@*/ /*@in@*/ /*@out@*/ urlinfo *uret, int mustAsk)
/* This URL is now cached. */ /* This URL is now cached. */
u = urlLink(uCache[ucx], "uCache"); if (uCache) /* XXX always true */
u = urlLink(uCache[ucx], "uCache");
*uret = u; *uret = u;
/*@-usereleased@*/ /*@-usereleased@*/
u = urlFree(u, "uCache (urlFind)"); u = urlFree(u, "uCache (urlFind)");
@ -239,8 +233,8 @@ static void urlFind(/*@null@*/ /*@in@*/ /*@out@*/ urlinfo *uret, int mustAsk)
if (u->urltype == URL_IS_FTP) { if (u->urltype == URL_IS_FTP) {
if (mustAsk || (u->user != NULL && u->password == NULL)) { if (mustAsk || (u->user != NULL && u->password == NULL)) {
/*@observer@*/ const char * host = (u->host ? u->host : ""); const char * host = (u->host ? u->host : "");
/*@observer@*/ const char * user = (u->user ? u->user : ""); const char * user = (u->user ? u->user : "");
char * prompt; char * prompt;
prompt = alloca(strlen(host) + strlen(user) + 256); prompt = alloca(strlen(host) + strlen(user) + 256);
sprintf(prompt, _("Password for %s@%s: "), user, host); sprintf(prompt, _("Password for %s@%s: "), user, host);