diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2009-10-24 14:12:01 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2009-10-24 14:12:01 +0200 |
commit | 5cbf7810a2d9f8905015d8a7879df095cfb6d6ea (patch) | |
tree | fd498659b258b37402c95b0b1273a14c636abfb9 /apt-pkg | |
parent | ce26dee77d08876b2022ce480c8f7dd616f94df1 (diff) |
Avoid extra inner copy in APT_MKSTRCMP and APT_MKSTRCMP2
Backported from lp:~mvo/apt/debian-experimental
Patch by Eugene V. Lyubimkin
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/contrib/strutl.h | 12 |
1 files changed, 6 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); |