Commit 73f8c999 authored by Dominik Charousset's avatar Dominik Charousset

No longer support match w/o value storage

parent d5284194
...@@ -87,10 +87,8 @@ struct meta_elements<type_list<Ts...>> { ...@@ -87,10 +87,8 @@ struct meta_elements<type_list<Ts...>> {
} }
}; };
bool try_match(const message& msg, bool try_match(const message& msg, const meta_element* pattern_begin,
const meta_element* pattern_begin, size_t pattern_size, void** out);
size_t pattern_size,
void** out = nullptr);
} // namespace detail } // namespace detail
} // namespace caf } // namespace caf
......
...@@ -34,9 +34,7 @@ bool match_element(const meta_element& me, const message& msg, ...@@ -34,9 +34,7 @@ bool match_element(const meta_element& me, const message& msg,
if (!msg.match_element(pos, me.typenr, me.type)) { if (!msg.match_element(pos, me.typenr, me.type)) {
return false; return false;
} }
if (storage) {
*storage = const_cast<void*>(msg.at(pos)); *storage = const_cast<void*>(msg.at(pos));
}
return true; return true;
} }
...@@ -46,7 +44,6 @@ bool match_atom_constant(const meta_element& me, const message& msg, ...@@ -46,7 +44,6 @@ bool match_atom_constant(const meta_element& me, const message& msg,
if (!msg.match_element(pos, detail::type_nr<atom_value>::value, nullptr)) { if (!msg.match_element(pos, detail::type_nr<atom_value>::value, nullptr)) {
return false; return false;
} }
if (storage) {
auto ptr = msg.at(pos); auto ptr = msg.at(pos);
if (me.v != *reinterpret_cast<const atom_value*>(ptr)) { if (me.v != *reinterpret_cast<const atom_value*>(ptr)) {
return false; return false;
...@@ -58,7 +55,6 @@ bool match_atom_constant(const meta_element& me, const message& msg, ...@@ -58,7 +55,6 @@ bool match_atom_constant(const meta_element& me, const message& msg,
// does not have any members. Hence, this is nonetheless safe since // does not have any members. Hence, this is nonetheless safe since
// we are never actually going to dereference the pointer. // we are never actually going to dereference the pointer.
*storage = const_cast<void*>(ptr); *storage = const_cast<void*>(ptr);
}
return true; return true;
} }
...@@ -74,7 +70,7 @@ class set_commit_rollback { ...@@ -74,7 +70,7 @@ class set_commit_rollback {
++m_pos; ++m_pos;
} }
inline pointer current() { inline pointer current() {
return m_data? &m_data[m_pos] : nullptr; return &m_data[m_pos];
} }
inline void commit() { inline void commit() {
m_fallback_pos = m_pos; m_fallback_pos = m_pos;
...@@ -130,6 +126,8 @@ bool try_match(const message& msg, size_t msg_pos, size_t msg_size, ...@@ -130,6 +126,8 @@ bool try_match(const message& msg, size_t msg_pos, size_t msg_size,
} }
bool try_match(const message& msg, pattern_iterator pb, size_t ps, void** out) { bool try_match(const message& msg, pattern_iterator pb, size_t ps, void** out) {
CAF_REQUIRE(out != nullptr);
CAF_REQUIRE(msg.empty() || msg.vals()->get_reference_count() > 0);
set_commit_rollback scr{out}; set_commit_rollback scr{out};
return try_match(msg, 0, msg.size(), pb, pb + ps, scr); return try_match(msg, 0, msg.size(), pb, pb + ps, scr);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment