From 7363356682ff3609bbf8fbd8aacf2908e81a6587 Mon Sep 17 00:00:00 2001 From: Tor Egge Date: Thu, 3 Dec 2020 20:28:30 +0100 Subject: Remove old juniper stl workaround. --- juniper/src/vespa/juniper/Matcher.cpp | 4 +- juniper/src/vespa/juniper/Matcher.h | 1 - juniper/src/vespa/juniper/keyocc.h | 1 - juniper/src/vespa/juniper/matchelem.h | 4 +- juniper/src/vespa/juniper/mcand.h | 2 +- juniper/src/vespa/juniper/multiset.h | 81 ----------------------------------- juniper/src/vespa/juniper/sumdesc.h | 2 +- 7 files changed, 6 insertions(+), 89 deletions(-) delete mode 100644 juniper/src/vespa/juniper/multiset.h (limited to 'juniper/src') diff --git a/juniper/src/vespa/juniper/Matcher.cpp b/juniper/src/vespa/juniper/Matcher.cpp index 9b91166fa29..bb5bc0bdcae 100644 --- a/juniper/src/vespa/juniper/Matcher.cpp +++ b/juniper/src/vespa/juniper/Matcher.cpp @@ -375,8 +375,8 @@ void Matcher::log_matches(int printcount) _log_text.append(""); if (m.size() > 0) { _log_text.append(""); - sprintf(buf, ""); } diff --git a/juniper/src/vespa/juniper/Matcher.h b/juniper/src/vespa/juniper/Matcher.h index 6bbb307b74c..db90a5a3091 100644 --- a/juniper/src/vespa/juniper/Matcher.h +++ b/juniper/src/vespa/juniper/Matcher.h @@ -16,7 +16,6 @@ #include #include -#include "multiset.h" #include #include #include "ITokenProcessor.h" diff --git a/juniper/src/vespa/juniper/keyocc.h b/juniper/src/vespa/juniper/keyocc.h index fae4861d1ef..c957909ac90 100644 --- a/juniper/src/vespa/juniper/keyocc.h +++ b/juniper/src/vespa/juniper/keyocc.h @@ -1,7 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include "multiset.h" #include "matchelem.h" #include "querynode.h" diff --git a/juniper/src/vespa/juniper/matchelem.h b/juniper/src/vespa/juniper/matchelem.h index 23510c6d333..b0af8f3364f 100644 --- a/juniper/src/vespa/juniper/matchelem.h +++ b/juniper/src/vespa/juniper/matchelem.h @@ -4,7 +4,7 @@ #pragma once #include -#include "multiset.h" +#include #include "querynode.h" class Matcher; @@ -20,7 +20,7 @@ struct sequential_elem return m1->starttoken() < m2->starttoken(); } }; -typedef JUNIPER_SET > keylist; +typedef std::set > keylist; class MatchElement { diff --git a/juniper/src/vespa/juniper/mcand.h b/juniper/src/vespa/juniper/mcand.h index 0928c55ddea..fee86fd83af 100644 --- a/juniper/src/vespa/juniper/mcand.h +++ b/juniper/src/vespa/juniper/mcand.h @@ -18,7 +18,7 @@ struct gtematch_cand { bool operator()(const MatchCandidate* m1, const MatchCandidate* m2) const; bool gtDistance(const MatchCandidate* m1, const MatchCandidate* m2) const; }; -typedef JUNIPER_MULTISET match_candidate_set; +typedef std::multiset match_candidate_set; class MatchCandidate : public MatchElement { diff --git a/juniper/src/vespa/juniper/multiset.h b/juniper/src/vespa/juniper/multiset.h deleted file mode 100644 index 5c4495080fe..00000000000 --- a/juniper/src/vespa/juniper/multiset.h +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#pragma once -#include -#include -#include - -#ifdef __GNUC__ -#define USE_STL_WORKAROUNDS 1 -#endif - -#ifdef USE_STL_WORKAROUNDS - -namespace fast { - -// STL like wrapper around Fast_Array providing multiset functionality - - -template -class multiset -{ -public: - - class iterator - : public std::iterator - { - public: - iterator(multiset& mset, int pos) : _myset(mset), _pos(pos) {} - inline ValueType operator*() { return _myset._values[_pos]; } - inline iterator& operator++() { _pos++; return *this; } - inline iterator& operator--() { _pos--; return *this; } - inline bool operator!=(const iterator& i2) { return i2._pos != _pos; } - inline bool operator==(const iterator& i2) { return i2._pos == _pos; } - protected: - friend class multiset; - const multiset& _myset; - int _pos; - }; - - inline multiset() : _values(), _sorted(true) {} - - inline bool insert(ValueType& v) - { - _sorted = false; - _values.push_back(v); - return true; - } - - inline void clear() { _values.clear(); _sorted = true; } - - inline int size() const { return _values.size(); } - - iterator begin() { sort(); return iterator(*this, 0); } - iterator end() { return iterator(*this, size()); } - -protected: - inline void sort() - { - if (!_sorted) { - std::stable_sort(_values.begin(), _values.end(), Comparator()); - _sorted = true; - } - } - -private: - friend class iterator; - std::vector _values; - bool _sorted; -}; // end class multiset - -} // end namespace fast - -#define JUNIPER_MULTISET fast::multiset -#define JUNIPER_SET fast::multiset - -#else -#include -#define JUNIPER_MULTISET std::multiset -#define JUNIPER_SET std::set -#endif - diff --git a/juniper/src/vespa/juniper/sumdesc.h b/juniper/src/vespa/juniper/sumdesc.h index 0af1f2d3cd2..e80bf9ba9f2 100644 --- a/juniper/src/vespa/juniper/sumdesc.h +++ b/juniper/src/vespa/juniper/sumdesc.h @@ -61,7 +61,7 @@ protected: void add_desc(off_t pos, ssize_t len, bool highlight); - typedef JUNIPER_SET > cand_list; + typedef std::set > cand_list; typedef std::list print_list; /** Helper function to build a simple query highlight of the complete document */ -- cgit v1.2.3
Topmost %d matches out of %d", - nterms+2, std::min(printcount, m.size()),m.size()); + sprintf(buf, "Topmost %zu matches out of %zu", + nterms+2, std::min(static_cast(printcount), m.size()),m.size()); _log_text.append(buf); _log_text.append("