]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fixed formatting
authorFrancesco Chemolli <kinkie@squid-cache.org>
Thu, 5 Dec 2013 15:26:22 +0000 (16:26 +0100)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Thu, 5 Dec 2013 15:26:22 +0000 (16:26 +0100)
Moved ToSBufList from SBufList.h/cc to wordlist.h/cc
Fixed some misnamed parameters in SBufAlgos.h

src/Makefile.am
src/SBufAlgos.h
src/SBufList.cc
src/SBufList.h
src/wordlist.cc
src/wordlist.h

index 9e6e9d280c675bb8f8be4c7e0cbd7cef426f1c64..191c6de5a2e1900902f28d746b56d2cafe1dfe60 100644 (file)
@@ -2540,6 +2540,8 @@ tests_testHttpParser_SOURCES = \
        String.cc \
        cache_cf.h \
        YesNoNone.h \
+       $(SBUF_SOURCE) \
+       tests/stub_SBufDetailedStats.cc \
        tests/stub_cache_cf.cc \
        tests/stub_cache_manager.cc \
        tests/stub_debug.cc \
@@ -2989,6 +2991,9 @@ tests_testString_SOURCES = \
        tests/stub_mem.cc \
        MemBuf.cc \
        String.cc \
+       $(SBUF_SOURCE) \
+       SBufDetailedStats.h \
+       tests/stub_SBufDetailedStats.cc \
        tests/testMain.cc \
        tests/testString.cc \
        tests/testString.h \
@@ -3714,6 +3719,9 @@ tests_testConfigParser_SOURCES = \
        tests/stub_mem.cc \
        tests/stub_MemBuf.cc \
        tests/stub_time.cc \
+       $(SBUF_SOURCE) \
+       SBufDetailedStats.h \
+       tests/stub_SBufDetailedStats.cc \
        String.cc \
        ConfigParser.cc \
        fatal.h \
index 988361091b06c246e621b7b886a43bfdd3648e0f..ae43c036824738d832f02e6d5e3e29135aafcbe1 100644 (file)
@@ -6,32 +6,35 @@
 #include <numeric>
 
 /// SBuf equality predicate for STL algorithms etc
-class SBufEqual {
+class SBufEqual
+{
 public:
-    explicit SBufEqual(const SBuf &reference, SBufCaseSensitive caseSensitivity_ = caseSensitive) :
-        reference_(reference), sensitivity_(caseSensitivity_) {}
-    inline bool operator() (const SBuf & checking) { return 0 == checking.compare(reference_,sensitivity_); }
+    explicit SBufEqual(const SBuf &reference, SBufCaseSensitive sensitivity = caseSensitive) :
+        reference_(reference), sensitivity_(sensitivity) {}
+    bool operator() (const SBuf & checking) { return checking.compare(reference_,sensitivity_) == 0; }
 private:
     SBuf reference_;
     SBufCaseSensitive sensitivity_;
 };
 
 /// SBuf "starts with" predicate for STL algorithms etc
-class SBufStartsWith {
+class SBufStartsWith
+{
 public:
-    explicit SBufStartsWith(const SBuf &prefix, SBufCaseSensitive caseSensitive = caseSensitive) :
-        prefix_(prefix), sensitive(caseSensitive) {}
-    inline bool operator() (const SBuf & checking) { return checking.startsWith(prefix_,sensitive); }
+    explicit SBufStartsWith(const SBuf &prefix, SBufCaseSensitive sensitivity = caseSensitive) :
+        prefix_(prefix), sensitivity_(sensitivity) {}
+    bool operator() (const SBuf & checking) { return checking.startsWith(prefix_,sensitivity_); }
 private:
     SBuf prefix_;
-    SBufCaseSensitive sensitive;
+    SBufCaseSensitive sensitivity_;
 };
 
 /** SBuf size addition accumulator for STL contaniners
  *
  * Equivalent to prefix_length +  SBuf.length() +  separator.length()
  */
-class SBufAddLength {
+class SBufAddLength
+{
 public:
     explicit SBufAddLength(const SBuf &separator) :
         separator_len(separator.length()) {}
@@ -48,8 +51,7 @@ SBuf
 SBufContainerJoin(const Container &items, const SBuf& separator)
 {
     // optimization: pre-calculate needed storage
-    SBuf::size_type sz;
-    sz = std::accumulate(items.begin(), items.end(), 0, SBufAddLength(separator));
+    const SBuf::size_type sz = std::accumulate(items.begin(), items.end(), 0, SBufAddLength(separator));
 
     // protect against blindly dereferencing items.begin() if items.size()==0
     if (sz == 0)
index adbf5767a20fc279a50a94b639d735aac2a4d00f..80827ae4238d90e1af1c50f4f9fcb2c8115d8d0c 100644 (file)
@@ -8,14 +8,3 @@ IsMember(const SBufList & sl, const SBuf &S, const SBufCaseSensitive case_sensit
 {
     return std::find_if(sl.begin(), sl.end(), SBufEqual(S,case_sensitive)) != sl.end();
 }
-
-SBufList
-ToSBufList(wordlist *wl)
-{
-    SBufList rv;
-    while (wl != NULL) {
-        rv.push_back(SBuf(wl->key));
-        wl = wl->next;
-    }
-    return rv;
-}
index d95815b86000ed30d26a6e5c796d7a25d4a9c18f..5dec76bb2381f3c3d9aaee56ef8d6dc66477c046 100644 (file)
@@ -14,9 +14,4 @@ typedef std::list<SBuf> SBufList;
  */
 bool IsMember(const SBufList &, const SBuf &, const SBufCaseSensitive isCaseSensitive = caseSensitive);
 
-class wordlist;
-
-/// convert a wordlist to a SBufList
-SBufList ToSBufList(wordlist *);
-
 #endif /* SQUID_SBUFLIST_H */
index 8a9bdc09d7cb0b0292fed8b242708eceabe268c2..7df0087a9e54164b27e1e373b6939b6dcb452a84 100644 (file)
@@ -109,3 +109,14 @@ wordlistDup(const wordlist * w)
 
     return D;
 }
+
+SBufList
+ToSBufList(wordlist *wl)
+{
+    SBufList rv;
+    while (wl != NULL) {
+        rv.push_back(SBuf(wl->key));
+        wl = wl->next;
+    }
+    return rv;
+}
index 497a2ab6d5fff7a846b9aa00b4cae6d6427d2b9a..fafdb63c47acc1d906faf16c8eb3604f22879ce9 100644 (file)
@@ -33,6 +33,7 @@
 #include "globals.h"
 #include "MemPool.h"
 #include "profiler/Profiler.h"
+#include "SBufList.h"
 
 /** A list of C-strings
  *
@@ -49,29 +50,38 @@ public:
 MEMPROXY_CLASS_INLINE(wordlist);
 
 class MemBuf;
+
 /** Add a null-terminated c-string to a wordlist
  *
  * \deprecated use SBufList.push_back(SBuf(word)) instead
  */
 const char *wordlistAdd(wordlist **, const char *);
+
 /** Concatenate a wordlist
  *
  * \deprecated use SBufListContainerJoin(SBuf()) from SBufAlgos.h instead
  */
 void wordlistCat(const wordlist *, MemBuf *);
+
 /** append a wordlist to another
  *
  * \deprecated use SBufList.merge(otherwordlist) instead
  */
 void wordlistAddWl(wordlist **, wordlist *);
+
 /** Concatenate the words in a wordlist
  *
  * \deprecated use SBufListContainerJoin(SBuf()) from SBufAlgos.h instead
  */
 void wordlistJoin(wordlist **, wordlist **);
+
 /// duplicate a wordlist
 wordlist *wordlistDup(const wordlist *);
+
 /// destroy a wordlist
 void wordlistDestroy(wordlist **);
 
+/// convert a wordlist to a SBufList
+SBufList ToSBufList(wordlist *);
+
 #endif /* SQUID_WORDLIST_H */