summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2009-10-24 14:12:01 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2009-10-24 14:12:01 +0200
commit5cbf7810a2d9f8905015d8a7879df095cfb6d6ea (patch)
treefd498659b258b37402c95b0b1273a14c636abfb9
parentce26dee77d08876b2022ce480c8f7dd616f94df1 (diff)
Avoid extra inner copy in APT_MKSTRCMP and APT_MKSTRCMP2
Backported from lp:~mvo/apt/debian-experimental Patch by Eugene V. Lyubimkin
-rw-r--r--apt-pkg/contrib/strutl.h12
-rw-r--r--debian/changelog4
2 files changed, 10 insertions, 6 deletions
diff --git a/apt-pkg/contrib/strutl.h b/apt-pkg/contrib/strutl.h
index 0cbf14a7a..2b2e147fb 100644
--- a/apt-pkg/contrib/strutl.h
+++ b/apt-pkg/contrib/strutl.h
@@ -68,15 +68,15 @@ int tolower_ascii(int c);
#define APT_MKSTRCMP(name,func) \
inline int name(const char *A,const char *B) {return func(A,A+strlen(A),B,B+strlen(B));}; \
inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));}; \
-inline int name(string A,const char *B) {return func(A.c_str(),A.c_str()+A.length(),B,B+strlen(B));}; \
-inline int name(string A,string B) {return func(A.c_str(),A.c_str()+A.length(),B.c_str(),B.c_str()+B.length());}; \
-inline int name(string A,const char *B,const char *BEnd) {return func(A.c_str(),A.c_str()+A.length(),B,BEnd);};
+inline int name(const string& A,const char *B) {return func(A.c_str(),A.c_str()+A.length(),B,B+strlen(B));}; \
+inline int name(const string& A,const string& B) {return func(A.c_str(),A.c_str()+A.length(),B.c_str(),B.c_str()+B.length());}; \
+inline int name(const string& A,const char *B,const char *BEnd) {return func(A.c_str(),A.c_str()+A.length(),B,BEnd);};
#define APT_MKSTRCMP2(name,func) \
inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));}; \
-inline int name(string A,const char *B) {return func(A.begin(),A.end(),B,B+strlen(B));}; \
-inline int name(string A,string B) {return func(A.begin(),A.end(),B.begin(),B.end());}; \
-inline int name(string A,const char *B,const char *BEnd) {return func(A.begin(),A.end(),B,BEnd);};
+inline int name(const string& A,const char *B) {return func(A.begin(),A.end(),B,B+strlen(B));}; \
+inline int name(const string& A,const string& B) {return func(A.begin(),A.end(),B.begin(),B.end());}; \
+inline int name(const string& A,const char *B,const char *BEnd) {return func(A.begin(),A.end(),B,BEnd);};
int stringcmp(const char *A,const char *AEnd,const char *B,const char *BEnd);
int stringcasecmp(const char *A,const char *AEnd,const char *B,const char *BEnd);
diff --git a/debian/changelog b/debian/changelog
index cd5f95016..80369e8e7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -32,6 +32,10 @@ apt (0.7.25) UNRELEASED; urgency=low
* methods/connect.cc:
- display also strerror of "wicked" getaddrinfo errors
+ [ Eugene V. Lyubimkin ]
+ * apt-pkg/contib/strutl.h
+ - Avoid extra inner copy in APT_MKSTRCMP and APT_MKSTRCMP2.
+
[ Julian Andres Klode ]
* doc/apt.conf.5.xml:
- Deprecate unquoted values, string concatenation and explain what should