summaryrefslogtreecommitdiff
path: root/apt-pkg/tagfile-compat.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2016-01-07 19:16:23 +0100
committerJulian Andres Klode <jak@debian.org>2016-01-07 19:59:08 +0100
commiteff0c22e59e65b6b63e854ff41eb091278e05714 (patch)
tree8496b397479c397085bb57dd4756c9113b4e2cbf /apt-pkg/tagfile-compat.cc
parentfe7fa47c1141066c89ab3382c318a4b9d00fe249 (diff)
Switch performance critical code to use APT::StringView
This improves performance of the cache generation on my ARM platform (4x Cortex A15) by about 10% to 20% from 2.35-2.50 to 2.1 seconds.
Diffstat (limited to 'apt-pkg/tagfile-compat.cc')
-rw-r--r--apt-pkg/tagfile-compat.cc76
1 files changed, 76 insertions, 0 deletions
diff --git a/apt-pkg/tagfile-compat.cc b/apt-pkg/tagfile-compat.cc
new file mode 100644
index 000000000..fe53e2974
--- /dev/null
+++ b/apt-pkg/tagfile-compat.cc
@@ -0,0 +1,76 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+// $Id: tagfile.cc,v 1.37.2.2 2003/12/31 16:02:30 mdz Exp $
+/* ######################################################################
+
+ Fast scanner for RFC-822 type header information
+
+ This uses a rotating buffer to load the package information into.
+ The scanner runs over it and isolates and indexes a single section.
+
+ This defines compat functions for the external code.
+
+ ##################################################################### */
+ /*}}}*/
+
+#include<config.h>
+#define APT_COMPILING_TAGFILE_COMPAT_CC
+#include <apt-pkg/tagfile.h>
+
+using std::string;
+using APT::StringView;
+
+
+bool pkgTagSection::Exists(const char* const Tag) const
+{
+ return Exists(StringView(Tag));
+}
+
+bool pkgTagSection::Find(const char *Tag,unsigned int &Pos) const
+{
+ return Find(StringView(Tag), Pos);
+}
+
+bool pkgTagSection::Find(const char *Tag,const char *&Start,
+ const char *&End) const
+{
+ return Find(StringView(Tag), Start, End);
+}
+
+string pkgTagSection::FindS(const char *Tag) const
+{
+ return Find(StringView(Tag)).to_string();
+}
+
+string pkgTagSection::FindRawS(const char *Tag) const
+{
+ return FindRaw(StringView(Tag)).to_string();
+}
+
+signed int pkgTagSection::FindI(const char *Tag,signed long Default) const
+{
+ return FindI(StringView(Tag), Default);
+}
+
+unsigned long long pkgTagSection::FindULL(const char *Tag, unsigned long long const &Default) const
+{
+ return FindULL(StringView(Tag), Default);
+}
+ /*}}}*/
+
+bool pkgTagSection::FindB(const char *Tag, bool const &Default) const
+{
+ return FindB(StringView(Tag), Default);
+}
+
+bool pkgTagSection::FindFlag(const char * const Tag, uint8_t &Flags,
+ uint8_t const Flag) const
+{
+ return FindFlag(StringView(Tag), Flags, Flag);
+}
+
+bool pkgTagSection::FindFlag(const char *Tag,unsigned long &Flags,
+ unsigned long Flag) const
+{
+ return FindFlag(StringView(Tag), Flags, Flag);
+}