From: Jay Freeman (saurik) Date: Wed, 30 Nov 2016 08:39:04 +0000 (-0800) Subject: The fastest way to get field values is as a range. X-Git-Tag: cydia_1.1.28%b1~5 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/f3514c6d0f434e007266988edaed1c3d90c5676b The fastest way to get field values is as a range. --- diff --git a/apt-pkg/deb/debrecords.cc b/apt-pkg/deb/debrecords.cc index 6d642c7b8..e7025d911 100644 --- a/apt-pkg/deb/debrecords.cc +++ b/apt-pkg/deb/debrecords.cc @@ -210,6 +210,12 @@ void debRecordParserBase::GetRec(const char *&Start,const char *&Stop) Section.GetSection(Start,Stop); } /*}}}*/ +// RecordParserBase::Find - Locate a tag /*{{{*/ +bool debRecordParserBase::Find(const char *Tag,const char *&Start, const char *&End) +{ + return Section.Find(Tag,Start,End); +} + /*}}}*/ debRecordParserBase::~debRecordParserBase() {} bool debDebFileRecordParser::LoadContent() diff --git a/apt-pkg/deb/debrecords.h b/apt-pkg/deb/debrecords.h index 8f443c9a3..b412dbaef 100644 --- a/apt-pkg/deb/debrecords.h +++ b/apt-pkg/deb/debrecords.h @@ -51,6 +51,7 @@ class APT_HIDDEN debRecordParserBase : public pkgRecords::Parser virtual std::string RecordField(const char *fieldName) APT_OVERRIDE; virtual void GetRec(const char *&Start,const char *&Stop) APT_OVERRIDE; + virtual bool Find(const char *Tag,const char *&Start, const char *&End) APT_OVERRIDE; debRecordParserBase(); virtual ~debRecordParserBase(); diff --git a/apt-pkg/pkgrecords.h b/apt-pkg/pkgrecords.h index a151fa123..b5eec305e 100644 --- a/apt-pkg/pkgrecords.h +++ b/apt-pkg/pkgrecords.h @@ -101,6 +101,9 @@ class pkgRecords::Parser /*{{{*/ // The record in binary form virtual void GetRec(const char *&Start,const char *&Stop) {Start = Stop = 0;}; + // Locate a tag + virtual bool Find(const char *Tag,const char *&Start, const char *&End) {Start = End = 0; return false;}; + Parser(); virtual ~Parser();