summaryrefslogtreecommitdiff
path: root/apt-pkg/pkgcachegen.h
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2016-01-08 00:41:14 +0100
committerJulian Andres Klode <jak@debian.org>2016-01-08 00:41:14 +0100
commitdd592790c8f1be4925f74266742c163516ab80c7 (patch)
tree1db0b274aee9f38d6d04829147805a7e7395e752 /apt-pkg/pkgcachegen.h
parentc5a858e39f83676fdf16f1bdae5966c96ee882ff (diff)
pkgCacheGenerator: Use StringView for toString
This removes some minor overhead. Gbp-Dch: ignore
Diffstat (limited to 'apt-pkg/pkgcachegen.h')
-rw-r--r--apt-pkg/pkgcachegen.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h
index 9455f0b7a..e4760d44d 100644
--- a/apt-pkg/pkgcachegen.h
+++ b/apt-pkg/pkgcachegen.h
@@ -104,7 +104,10 @@ class APT_HIDDEN pkgCacheGenerator /*{{{*/
enum StringType { MIXED, PKGNAME, VERSIONNUMBER, SECTION };
map_stringitem_t StoreString(StringType const type, const char * S, unsigned int const Size);
- inline map_stringitem_t StoreString(enum StringType const type, const std::string &S) {return StoreString(type, S.c_str(),S.length());};
+
+#ifdef APT_PKG_EXPOSE_STRING_VIEW
+ inline map_stringitem_t StoreString(enum StringType const type, APT::StringView S) {return StoreString(type, S.data(),S.length());};
+#endif
void DropProgress() {Progress = 0;};
bool SelectFile(const std::string &File,pkgIndexFile const &Index, std::string const &Architecture, std::string const &Component, unsigned long Flags = 0);
@@ -156,8 +159,10 @@ class APT_HIDDEN pkgCacheListParser
protected:
- inline map_stringitem_t StoreString(pkgCacheGenerator::StringType const type, std::string const &S) {return Owner->StoreString(type, S);};
inline map_stringitem_t StoreString(pkgCacheGenerator::StringType const type, const char *S,unsigned int Size) {return Owner->StoreString(type, S, Size);};
+#ifdef APT_PKG_EXPOSE_STRING_VIEW
+ inline map_stringitem_t StoreString(pkgCacheGenerator::StringType const type, APT::StringView S) {return Owner->StoreString(type, S);};
+#endif
inline map_stringitem_t WriteString(const std::string &S) {return Owner->WriteStringInMap(S);};
inline map_stringitem_t WriteString(const char *S,unsigned int Size) {return Owner->WriteStringInMap(S,Size);};