From fd282b1e5334652827ad4d251e674322af73f2dc Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Wed, 30 Nov 2016 00:39:04 -0800 Subject: The fastest way to get field values is as a range. --- apt-pkg/deb/debrecords.cc | 6 ++++++ apt-pkg/deb/debrecords.h | 1 + apt-pkg/pkgrecords.h | 3 +++ 3 files changed, 10 insertions(+) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/debrecords.cc b/apt-pkg/deb/debrecords.cc index e0e8a4c49..0fcb9987e 100644 --- a/apt-pkg/deb/debrecords.cc +++ b/apt-pkg/deb/debrecords.cc @@ -208,6 +208,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 dca6dda20..def580223 100644 --- a/apt-pkg/deb/debrecords.h +++ b/apt-pkg/deb/debrecords.h @@ -50,6 +50,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 dec722330..f78a6229f 100644 --- a/apt-pkg/pkgrecords.h +++ b/apt-pkg/pkgrecords.h @@ -100,6 +100,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(); -- cgit v1.2.3