Get rid of the second context, not needed it is always the same

This commit is contained in:
hofmockel 2014-01-24 17:18:29 +01:00
parent a83a15e1a8
commit 9133c81f9e
3 changed files with 5 additions and 10 deletions

View file

@ -206,7 +206,6 @@ cdef class PyGenericFilterPolicy(PyFilterPolicy):
self.policy = <filter_policy.FilterPolicy*> new filter_policy.FilterPolicyWrapper(
bytes_to_string(ob.name()),
<void*>ob,
<void*>ob,
create_filter_callback,
key_may_match_callback)

View file

@ -20,13 +20,11 @@ namespace py_rocks {
FilterPolicyWrapper(
string name,
void* create_filter_context,
void* key_may_match_context,
void* ctx,
create_filter_func create_filter_callback,
key_may_match_func key_may_match_callback):
name(name),
create_filter_context(create_filter_context),
key_may_match_context(key_may_match_context),
ctx(ctx),
create_filter_callback(create_filter_callback),
key_may_match_callback(key_may_match_callback)
{}
@ -34,7 +32,7 @@ namespace py_rocks {
void
CreateFilter(const Slice* keys, int n, std::string* dst) const {
this->create_filter_callback(
this->create_filter_context,
this->ctx,
keys,
n,
dst);
@ -43,7 +41,7 @@ namespace py_rocks {
bool
KeyMayMatch(const Slice& key, const Slice& filter) const {
return this->key_may_match_callback(
this->key_may_match_context,
this->ctx,
key,
filter);
}
@ -54,8 +52,7 @@ namespace py_rocks {
private:
string name;
void* create_filter_context;
void* key_may_match_context;
void* ctx;
create_filter_func create_filter_callback;
key_may_match_func key_may_match_callback;
};

View file

@ -19,6 +19,5 @@ cdef extern from "cpp/filter_policy_wrapper.hpp" namespace "py_rocks":
FilterPolicyWrapper(
string,
void*,
void*,
create_filter_func,
key_may_match_func) nogil except+