From cc8bc8073bc5d55fdecfceb4de34abe1fcd268d1 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Fri, 28 Apr 2000 02:56:03 +0000 Subject: *** empty log message *** --- gendepslist2.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'gendepslist2.cc') diff --git a/gendepslist2.cc b/gendepslist2.cc index dcfe140..13ac4de 100644 --- a/gendepslist2.cc +++ b/gendepslist2.cc @@ -174,6 +174,10 @@ void getRequires(FD_t fd, int current_hdlist) { for (ITs p = all_frequires.begin(); p != all_frequires.end(); p++) fprovided_by[*p] = *(new vector); } +bool notfound(const string &s) { + return strncmp(s.c_str(), "NOTFOUND_", sizeof("NOTFOUND_") - 1) == 0; +} + void getProvides(FD_t fd, int current_hdlist) { Header header; while ((header=headerRead(fd, HEADER_MAGIC_YES))) @@ -274,7 +278,7 @@ void printDepslist(ofstream *out1, ofstream *out2) { vector packages; set list = hdlist2names[0]; - int nb2hdlist[names.size()]; + int nb2hdlist[2 * names.size()]; // the 2x is a hacky hack. nb_names is not enough, need a little more int i = 0; string n; @@ -301,7 +305,10 @@ void printDepslist(ofstream *out1, ofstream *out2) { } } } - for (ITs p = list.begin(); p != list.end(); p++) hdlist2names[0].erase(*p); + for (ITs p = list.begin(); p != list.end(); p++) { + hdlist2names[0].erase(*p); + if (p->find('|') != string::npos) list.erase(*p); + } } else { list = hdlist2names[i]; } @@ -309,7 +316,7 @@ void printDepslist(ofstream *out1, ofstream *out2) { int l_best = 9999; for (ITs p = list.begin(); p != list.end(); p++) { - if (p->compare("NOTFOUND_") > 1) { + if (notfound(*p)) { list.erase(*p); continue; } @@ -354,7 +361,7 @@ void printDepslist(ofstream *out1, ofstream *out2) { verif(nb2hdlist[i], nb2hdlist[where[*k]], *p, *k); *out2 << where[*k]; } - } else if (q->compare("NOTFOUND_") > 1) { + } else if (notfound(*q)) { *out2 << " " << *q; } else { verif(nb2hdlist[i], nb2hdlist[where[*q]], *p, *q); -- cgit v1.2.1