Commit ceb5e1a0 authored by Martin Sustrik's avatar Martin Sustrik

Deallocation functions in zmq.h and msg_t class are consistent.

The two functions had different calling conventions (C vs. C++).
It is fixed now.
Signed-off-by: 's avatarMartin Sustrik <sustrik@250bpm.com>
parent 5e329ba7
...@@ -68,7 +68,7 @@ int zmq::msg_t::init_size (size_t size_) ...@@ -68,7 +68,7 @@ int zmq::msg_t::init_size (size_t size_)
return 0; return 0;
} }
int zmq::msg_t::init_data (void *data_, size_t size_, zmq_free_fn *ffn_, int zmq::msg_t::init_data (void *data_, size_t size_, msg_free_fn *ffn_,
void *hint_) void *hint_)
{ {
u.lmsg.type = type_lmsg; u.lmsg.type = type_lmsg;
......
...@@ -26,6 +26,14 @@ ...@@ -26,6 +26,14 @@
#include "config.hpp" #include "config.hpp"
#include "atomic_counter.hpp" #include "atomic_counter.hpp"
// Signature for free function to deallocate the message content.
// Note that it has to be declared as "C" so that it is the same as
// zmq_free_fn defined in zmq.h.
extern "C"
{
typedef void (msg_free_fn) (void *data, void *hint);
}
namespace zmq namespace zmq
{ {
...@@ -43,13 +51,10 @@ namespace zmq ...@@ -43,13 +51,10 @@ namespace zmq
shared = 128 shared = 128
}; };
// Signature for free function to deallocate the message content.
typedef void (free_fn_t) (void *data, void *hint);
bool check (); bool check ();
int init (); int init ();
int init_size (size_t size_); int init_size (size_t size_);
int init_data (void *data_, size_t size_, free_fn_t *ffn_, int init_data (void *data_, size_t size_, msg_free_fn *ffn_,
void *hint_); void *hint_);
int init_delimiter (); int init_delimiter ();
int close (); int close ();
...@@ -82,7 +87,7 @@ namespace zmq ...@@ -82,7 +87,7 @@ namespace zmq
{ {
void *data; void *data;
size_t size; size_t size;
free_fn_t *ffn; msg_free_fn *ffn;
void *hint; void *hint;
zmq::atomic_counter_t refcnt; zmq::atomic_counter_t refcnt;
}; };
......
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