Fix a bug where pkg_create does not make an md5 entry for the last item in

the packing list. Also use switch() instead of zillion "else if ()" and for()
loop instead of while() loop for traversing through linked list.

MFC candidate.

Submitted by:	Alec Wolman <wolman@cs.washington.edu>
This commit is contained in:
Maxim Sobolev 2001-01-12 11:36:12 +00:00
parent 3abc34d763
commit 242b263cbc
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=70964

View File

@ -35,19 +35,21 @@ check_list(char *home, Package *pkg)
{
char *where = home;
char *there = NULL;
PackingList p = pkg->head;
char *cp, name[FILENAME_MAX], buf[33];
PackingList p;
while (p) {
if (p->type == PLIST_CWD)
for (p = pkg->head; p != NULL; p = p->next)
switch (p->type) {
case PLIST_CWD:
where = p->name;
else if (p->type == PLIST_IGNORE)
break;
case PLIST_IGNORE:
p = p->next;
else if (p->type == PLIST_SRC) {
break;
case PLIST_SRC:
there = p->name;
}
else if (p->type == PLIST_FILE) {
char *cp, name[FILENAME_MAX], buf[33];
break;
case PLIST_FILE:
sprintf(name, "%s/%s", there ? there : where, p->name);
if ((cp = MD5File(name, buf)) != NULL) {
PackingList tmp = new_plist_entry();
@ -57,11 +59,14 @@ check_list(char *home, Package *pkg)
tmp->next = p->next;
tmp->prev = p;
p->next = tmp;
if (pkg->tail == p)
pkg->tail = tmp;
p = tmp;
}
break;
default:
break;
}
p = p->next;
}
}
static int