summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2019-02-04 19:50:16 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2019-06-11 14:45:55 +0200
commita6e86d51a0e32cdc91f2902b0d6b483af884dcca (patch)
tree528867efd4499d088a7204470b0ff10bdb87457f /apt-pkg/contrib
parent93e0ba2bfde58e6c1fbad53614083be8754d7ee8 (diff)
Make APT::StringView public
Diffstat (limited to 'apt-pkg/contrib')
-rw-r--r--apt-pkg/contrib/hashsum_template.h15
-rw-r--r--apt-pkg/contrib/string_view.h4
-rw-r--r--apt-pkg/contrib/strutl.cc5
-rw-r--r--apt-pkg/contrib/strutl.h7
4 files changed, 5 insertions, 26 deletions
diff --git a/apt-pkg/contrib/hashsum_template.h b/apt-pkg/contrib/hashsum_template.h
index f11fc2f1c..52b2cbab3 100644
--- a/apt-pkg/contrib/hashsum_template.h
+++ b/apt-pkg/contrib/hashsum_template.h
@@ -11,9 +11,7 @@
#include <cstring>
#include <string>
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
#include <apt-pkg/string_view.h>
-#endif
#include <apt-pkg/strutl.h>
@@ -77,17 +75,10 @@ class HashSumValue
return Value();
}
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
- APT_HIDDEN bool Set(APT::StringView Str)
- {
- return Hex2Num(Str,Sum,sizeof(Sum));
- }
-#else
- bool Set(std::string Str)
+ bool Set(APT::StringView Str)
{
return Hex2Num(Str,Sum,sizeof(Sum));
}
-#endif
inline void Set(unsigned char S[N/8])
{
for (int I = 0; I != sizeof(Sum); ++I)
@@ -99,8 +90,7 @@ class HashSumValue
memset(Sum,0,sizeof(Sum));
Set(Str);
}
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
- APT_HIDDEN explicit HashSumValue(APT::StringView const &Str)
+ explicit HashSumValue(APT::StringView const &Str)
{
memset(Sum,0,sizeof(Sum));
Set(Str);
@@ -110,7 +100,6 @@ class HashSumValue
memset(Sum,0,sizeof(Sum));
Set(Str);
}
-#endif
HashSumValue()
{
memset(Sum,0,sizeof(Sum));
diff --git a/apt-pkg/contrib/string_view.h b/apt-pkg/contrib/string_view.h
index 536744e32..443ea395e 100644
--- a/apt-pkg/contrib/string_view.h
+++ b/apt-pkg/contrib/string_view.h
@@ -9,7 +9,7 @@
* (at your option) any later version.
*/
-#if !defined(APT_STRINGVIEW_H) && defined(APT_PKG_EXPOSE_STRING_VIEW)
+#if !defined(APT_STRINGVIEW_H)
#define APT_STRINGVIEW_H
#include <apt-pkg/macros.h>
#include <string>
@@ -24,7 +24,7 @@ namespace APT {
* used by APT. It is not meant to be used in programs, only inside the
* library for performance critical paths.
*/
-class APT_HIDDEN StringView {
+class StringView {
const char *data_;
size_t size_;
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index e854c5bf1..c00bce5d5 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -1202,11 +1202,6 @@ static int HexDigit(int c)
// Hex2Num - Convert a long hex number into a buffer /*{{{*/
// ---------------------------------------------------------------------
/* The length of the buffer must be exactly 1/2 the length of the string. */
-bool Hex2Num(const string &Str,unsigned char *Num,unsigned int Length)
-{
- return Hex2Num(APT::StringView(Str), Num, Length);
-}
-
bool Hex2Num(const APT::StringView Str,unsigned char *Num,unsigned int Length)
{
if (Str.length() != Length*2)
diff --git a/apt-pkg/contrib/strutl.h b/apt-pkg/contrib/strutl.h
index ae0aaedf9..3853d5ba6 100644
--- a/apt-pkg/contrib/strutl.h
+++ b/apt-pkg/contrib/strutl.h
@@ -20,9 +20,7 @@
#include <limits>
#include <string>
#include <vector>
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
#include <apt-pkg/string_view.h>
-#endif
#include <stddef.h>
#include <time.h>
@@ -100,10 +98,7 @@ bool StrToNum(const char *Str,unsigned long &Res,unsigned Len,unsigned Base = 0)
bool StrToNum(const char *Str,unsigned long long &Res,unsigned Len,unsigned Base = 0);
bool Base256ToNum(const char *Str,unsigned long &Res,unsigned int Len);
bool Base256ToNum(const char *Str,unsigned long long &Res,unsigned int Len);
-bool Hex2Num(const std::string &Str,unsigned char *Num,unsigned int Length);
-#ifdef APT_PKG_EXPOSE_STRING_VIEW
-APT_HIDDEN bool Hex2Num(const APT::StringView Str,unsigned char *Num,unsigned int Length);
-#endif
+bool Hex2Num(const APT::StringView Str,unsigned char *Num,unsigned int Length);
// input changing string split
bool TokSplitString(char Tok,char *Input,char **List,
unsigned long ListMax);