$(SBUF_SOURCE) \
SBufDetailedStats.h \
tests/stub_SBufDetailedStats.cc \
+ SBufAlgos.h \
+ SBufAlgos.cc \
SBufStream.h \
tests/stub_time.cc \
tests/stub_debug.cc \
SBufList.h \
SBufList.cc \
SBufAlgos.h \
+ SBufAlgos.cc \
SBufDetailedStats.h \
tests/stub_SBufDetailedStats.cc \
SBufStream.h \
}
reAlloc(newsize);
}
-
-std::size_t std::hash<SBuf>::operator() (const SBuf & sbuf) const noexcept
-{
- //ripped and adapted from hash_string
- const char *s = sbuf.rawContent();
- size_t rv = 0;
- SBuf::size_type len=sbuf.length();
- while (len != 0) {
- rv ^= 271 * *s;
- ++s;
- --len;
- }
- return rv ^ (sbuf.length() * 271);
-}
return buf;
}
-namespace std {
- /// default hash functor to support std::unordered_map<SBuf,*>
- template <>
- struct hash<SBuf>
- {
- size_t operator()(const SBuf &) const noexcept;
- };
-}
-
inline
SBufIterator::SBufIterator(const SBuf &s, size_type pos)
: iter(s.rawContent()+pos)
--- /dev/null
+/*
+ * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
+#include "squid.h"
+#include "SBufAlgos.h"
+
+std::size_t std::hash<SBuf>::operator() (const SBuf & sbuf) const noexcept
+{
+ //ripped and adapted from hash_string
+ const char *s = sbuf.rawContent();
+ size_t rv = 0;
+ SBuf::size_type len=sbuf.length();
+ while (len != 0) {
+ rv ^= 271 * *s;
+ ++s;
+ --len;
+ }
+ return rv ^ (sbuf.length() * 271);
+}
return rv;
}
+namespace std {
+ /// default hash functor to support std::unordered_map<SBuf,*>
+ template <>
+ struct hash<SBuf>
+ {
+ size_t operator()(const SBuf &) const noexcept;
+ };
+}
+
#endif /* SQUID_SBUFALGOS_H_ */
#include "base/CharacterSet.h"
#include "SBuf.h"
#include "SBufFindTest.h"
+#include "SBufAlgos.h"
#include "SBufStream.h"
#include "SquidString.h"
#include "testSBuf.h"