Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
ab5abf6c
Commit
ab5abf6c
authored
Dec 16, 2009
by
Martin Sustrik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hint parameter added to zmq_free function
parent
02202ec3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
8 deletions
+13
-8
zmq.h
bindings/c/zmq.h
+2
-2
zmq.hpp
bindings/cpp/zmq.hpp
+6
-4
msg_content.hpp
src/msg_content.hpp
+1
-0
zmq.cpp
src/zmq.cpp
+4
-2
No files found.
bindings/c/zmq.h
View file @
ab5abf6c
...
...
@@ -106,12 +106,12 @@ typedef struct
unsigned
char
vsm_data
[
ZMQ_MAX_VSM_SIZE
];
}
zmq_msg_t
;
typedef
void
(
zmq_free_fn
)
(
void
*
data
);
typedef
void
(
zmq_free_fn
)
(
void
*
data
,
void
*
hint
);
ZMQ_EXPORT
int
zmq_msg_init
(
zmq_msg_t
*
msg
);
ZMQ_EXPORT
int
zmq_msg_init_size
(
zmq_msg_t
*
msg
,
size_t
size
);
ZMQ_EXPORT
int
zmq_msg_init_data
(
zmq_msg_t
*
msg
,
void
*
data
,
size_t
size
,
zmq_free_fn
*
ffn
);
size_t
size
,
zmq_free_fn
*
ffn
,
void
*
hint
);
ZMQ_EXPORT
int
zmq_msg_close
(
zmq_msg_t
*
msg
);
ZMQ_EXPORT
int
zmq_msg_move
(
zmq_msg_t
*
dest
,
zmq_msg_t
*
src
);
ZMQ_EXPORT
int
zmq_msg_copy
(
zmq_msg_t
*
dest
,
zmq_msg_t
*
src
);
...
...
bindings/cpp/zmq.hpp
View file @
ab5abf6c
...
...
@@ -74,9 +74,10 @@ namespace zmq
throw
error_t
();
}
inline
message_t
(
void
*
data_
,
size_t
size_
,
free_fn
*
ffn_
)
inline
message_t
(
void
*
data_
,
size_t
size_
,
free_fn
*
ffn_
,
void
*
hint_
=
NULL
)
{
int
rc
=
zmq_msg_init_data
(
this
,
data_
,
size_
,
ffn_
);
int
rc
=
zmq_msg_init_data
(
this
,
data_
,
size_
,
ffn_
,
hint_
);
if
(
rc
!=
0
)
throw
error_t
();
}
...
...
@@ -108,12 +109,13 @@ namespace zmq
throw
error_t
();
}
inline
void
rebuild
(
void
*
data_
,
size_t
size_
,
free_fn
*
ffn_
)
inline
void
rebuild
(
void
*
data_
,
size_t
size_
,
free_fn
*
ffn_
,
void
*
hint_
=
NULL
)
{
int
rc
=
zmq_msg_close
(
this
);
if
(
rc
!=
0
)
throw
error_t
();
rc
=
zmq_msg_init_data
(
this
,
data_
,
size_
,
ffn_
);
rc
=
zmq_msg_init_data
(
this
,
data_
,
size_
,
ffn_
,
hint_
);
if
(
rc
!=
0
)
throw
error_t
();
}
...
...
src/msg_content.hpp
View file @
ab5abf6c
...
...
@@ -42,6 +42,7 @@ namespace zmq
void
*
data
;
size_t
size
;
zmq_free_fn
*
ffn
;
void
*
hint
;
zmq
::
atomic_counter_t
refcnt
;
};
...
...
src/zmq.cpp
View file @
ab5abf6c
...
...
@@ -103,13 +103,14 @@ int zmq_msg_init_size (zmq_msg_t *msg_, size_t size_)
content
->
data
=
(
void
*
)
(
content
+
1
);
content
->
size
=
size_
;
content
->
ffn
=
NULL
;
content
->
hint
=
NULL
;
new
(
&
content
->
refcnt
)
zmq
::
atomic_counter_t
();
}
return
0
;
}
int
zmq_msg_init_data
(
zmq_msg_t
*
msg_
,
void
*
data_
,
size_t
size_
,
zmq_free_fn
*
ffn_
)
zmq_free_fn
*
ffn_
,
void
*
hint_
)
{
msg_
->
shared
=
0
;
msg_
->
content
=
(
zmq
::
msg_content_t
*
)
malloc
(
sizeof
(
zmq
::
msg_content_t
));
...
...
@@ -118,6 +119,7 @@ int zmq_msg_init_data (zmq_msg_t *msg_, void *data_, size_t size_,
content
->
data
=
data_
;
content
->
size
=
size_
;
content
->
ffn
=
ffn_
;
content
->
hint
=
hint_
;
new
(
&
content
->
refcnt
)
zmq
::
atomic_counter_t
();
return
0
;
}
...
...
@@ -139,7 +141,7 @@ int zmq_msg_close (zmq_msg_t *msg_)
content
->
refcnt
.
~
atomic_counter_t
();
if
(
content
->
ffn
)
content
->
ffn
(
content
->
data
);
content
->
ffn
(
content
->
data
,
content
->
hint
);
free
(
content
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment