summaryrefslogtreecommitdiff
path: root/apt-pkg/srcrecords.cc
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2014-06-10 14:43:56 +0200
committerMichael Vogt <mvo@debian.org>2014-06-10 14:43:56 +0200
commitc76af2fce4724977408c119452eab545b69a2d3b (patch)
tree9d6945f6bb7bef48630e56641801ee6dcfc80ce5 /apt-pkg/srcrecords.cc
parent4dde2b4285fc6288e44e915a0d7bc0faac114a2e (diff)
parent462557017a0d8be321ca7d3eb96072f4db6a92ec (diff)
Merge remote-tracking branch 'mvo/feature/srcrec-enum2' into debian/sid
Diffstat (limited to 'apt-pkg/srcrecords.cc')
-rw-r--r--apt-pkg/srcrecords.cc37
1 files changed, 24 insertions, 13 deletions
diff --git a/apt-pkg/srcrecords.cc b/apt-pkg/srcrecords.cc
index 775cf2e5f..f4d034b85 100644
--- a/apt-pkg/srcrecords.cc
+++ b/apt-pkg/srcrecords.cc
@@ -81,6 +81,27 @@ bool pkgSrcRecords::Restart()
return true;
}
/*}}}*/
+// SrcRecords::Next - Step to the next Source Record /*{{{*/
+// ---------------------------------------------------------------------
+/* Step to the next source package record */
+const pkgSrcRecords::Parser* pkgSrcRecords::Next()
+{
+ if (Current == Files.end())
+ return 0;
+
+ // Step to the next record, possibly switching files
+ while ((*Current)->Step() == false)
+ {
+ if (_error->PendingError() == true)
+ return 0;
+ ++Current;
+ if (Current == Files.end())
+ return 0;
+ }
+
+ return *Current;
+}
+ /*}}}*/
// SrcRecords::Find - Find the first source package with the given name /*{{{*/
// ---------------------------------------------------------------------
/* This searches on both source package names and output binary names and
@@ -88,21 +109,11 @@ bool pkgSrcRecords::Restart()
function to be called multiple times to get successive entries */
pkgSrcRecords::Parser *pkgSrcRecords::Find(const char *Package,bool const &SrcOnly)
{
- if (Current == Files.end())
- return 0;
-
while (true)
{
- // Step to the next record, possibly switching files
- while ((*Current)->Step() == false)
- {
- if (_error->PendingError() == true)
- return 0;
- ++Current;
- if (Current == Files.end())
- return 0;
- }
-
+ if(Next() == 0)
+ return 0;
+
// IO error somehow
if (_error->PendingError() == true)
return 0;