--------------------- PatchSet 4453 Date: 2007/05/05 14:33:54 Author: amosjeffries Branch: ayjwork Tag: (none) Log: Remove some duplicate functions. Members: src/SquidString.h:1.8.8.2->1.8.8.3 src/cache_cf.cc:1.79.2.5->1.79.2.6 src/tests/testStoreEntryStream.cc:1.2.12.1->1.2.12.2 Index: squid3/src/SquidString.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/SquidString.h,v retrieving revision 1.8.8.2 retrieving revision 1.8.8.3 diff -u -r1.8.8.2 -r1.8.8.3 --- squid3/src/SquidString.h 3 May 2007 13:37:05 -0000 1.8.8.2 +++ squid3/src/SquidString.h 5 May 2007 14:33:54 -0000 1.8.8.3 @@ -1,6 +1,6 @@ /* - * $Id: SquidString.h,v 1.8.8.2 2007/05/03 13:37:05 amosjeffries Exp $ + * $Id: SquidString.h,v 1.8.8.3 2007/05/05 14:33:54 amosjeffries Exp $ * * DEBUG: section 67 String * AUTHOR: Duane Wessels @@ -44,6 +44,9 @@ * For Release 3.1 it is expected that either std::string of another * custom managed type will be defined as default. * + * NP: checkout http://johnpanzer.com/tsc_cuj/ToolboxOfStrings.html + * for possibly better and faster strings. + * * This has been done for several reasons: * * The initial String implementation was incomplete and non-standard @@ -54,11 +57,15 @@ * These changes: * - move the old String class to SquidString making the * internal definition explicit. - * - provide a global typedef of 'string' for use in variables. - * - migrate the custom functions: - * buf() -> c_str() - * clean() -> clear() - * + * - provide the well-known type of 'string' for general use + * - migrate custom functions to well-known API: + * buf() -> c_str() + * clean() -> clear() + * - remove redundant functions: + * buf(char*) -> operator=(char*) + * initBuf(char*) -> operator=(char*) + * reset(char*) -> operator=(char*) + * - make init(char*) private for use by various assignment/costructor * - define standard string operators * - define debugs stream operator * @@ -67,14 +74,16 @@ #ifndef SQUID_STRING_H #define SQUID_STRING_H - /* Provide standard 'string' type */ - /* class defined by the #include file MUST present the basic std::string API */ + /* Provide standard 'string' type */ + /* class defined by the #include file MUST present the basic std::string API */ + /* at least partially as not all operatios are used by squid. */ + /* API Ref: http://www.sgi.com/tech/stl/basic_string.html */ #include "SqString.h" typedef SqString string; - /* Overload standard functions using the basic string API */ + /* Overload standard C functions using the basic string API */ inline int strncasecmp(const string &lhs, const char *rhs, size_t len) { return strncasecmp(lhs.c_str(), rhs, len); } inline int strncasecmp(const string &lhs, const string &rhs, size_t len) { return strncasecmp(lhs.c_str(), rhs.c_str(), len); } Index: squid3/src/cache_cf.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/cache_cf.cc,v retrieving revision 1.79.2.5 retrieving revision 1.79.2.6 diff -u -r1.79.2.5 -r1.79.2.6 --- squid3/src/cache_cf.cc 3 May 2007 13:37:05 -0000 1.79.2.5 +++ squid3/src/cache_cf.cc 5 May 2007 14:33:54 -0000 1.79.2.6 @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.79.2.5 2007/05/03 13:37:05 amosjeffries Exp $ + * $Id: cache_cf.cc,v 1.79.2.6 2007/05/05 14:33:54 amosjeffries Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -2208,7 +2208,7 @@ if (token == NULL) self_destruct(); - var.reset(token); + var = token; } static void Index: squid3/src/tests/testStoreEntryStream.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/tests/testStoreEntryStream.cc,v retrieving revision 1.2.12.1 retrieving revision 1.2.12.2 diff -u -r1.2.12.1 -r1.2.12.2 --- squid3/src/tests/testStoreEntryStream.cc 3 May 2007 13:37:09 -0000 1.2.12.1 +++ squid3/src/tests/testStoreEntryStream.cc 5 May 2007 14:33:55 -0000 1.2.12.2 @@ -39,7 +39,7 @@ stream.flush(); CPPUNIT_ASSERT_EQUAL(1, anEntry->_buffer_calls); CPPUNIT_ASSERT_EQUAL(1, anEntry->_flush_calls); - CPPUNIT_ASSERT_EQUAL((string)"some text !", anEntry->_appended_text); + CPPUNIT_ASSERT_EQUAL((string)"some text !", (string)anEntry->_appended_text); } delete anEntry;