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
9fc3692e
Commit
9fc3692e
authored
Feb 15, 2018
by
Simon Giesecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Problem: read-only arguments of mtrie are not declared as const
Solution: add const, introduce typedef
parent
31387f84
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
34 deletions
+31
-34
mtrie.cpp
src/mtrie.cpp
+7
-13
mtrie.hpp
src/mtrie.hpp
+19
-17
xpub.cpp
src/xpub.cpp
+2
-2
xpub.hpp
src/xpub.hpp
+3
-2
No files found.
src/mtrie.cpp
View file @
9fc3692e
...
...
@@ -57,14 +57,12 @@ zmq::mtrie_t::~mtrie_t ()
}
}
bool
zmq
::
mtrie_t
::
add
(
unsigned
char
*
prefix_
,
size_t
size_
,
pipe_t
*
pipe_
)
bool
zmq
::
mtrie_t
::
add
(
prefix_t
prefix_
,
size_t
size_
,
pipe_t
*
pipe_
)
{
return
add_helper
(
prefix_
,
size_
,
pipe_
);
}
bool
zmq
::
mtrie_t
::
add_helper
(
unsigned
char
*
prefix_
,
size_t
size_
,
pipe_t
*
pipe_
)
bool
zmq
::
mtrie_t
::
add_helper
(
prefix_t
prefix_
,
size_t
size_
,
pipe_t
*
pipe_
)
{
// We are at the node corresponding to the prefix. We are done.
if
(
!
size_
)
{
...
...
@@ -139,9 +137,7 @@ bool zmq::mtrie_t::add_helper (unsigned char *prefix_,
void
zmq
::
mtrie_t
::
rm
(
pipe_t
*
pipe_
,
void
(
*
func_
)
(
unsigned
char
*
data_
,
size_t
size_
,
void
*
arg_
),
void
(
*
func_
)
(
prefix_t
data_
,
size_t
size_
,
void
*
arg_
),
void
*
arg_
,
bool
call_on_uniq_
)
{
...
...
@@ -154,7 +150,7 @@ void zmq::mtrie_t::rm_helper (pipe_t *pipe_,
unsigned
char
**
buff_
,
size_t
buffsize_
,
size_t
maxbuffsize_
,
void
(
*
func_
)
(
unsigned
char
*
data_
,
void
(
*
func_
)
(
prefix_t
data_
,
size_t
size_
,
void
*
arg_
),
void
*
arg_
,
...
...
@@ -275,14 +271,12 @@ void zmq::mtrie_t::rm_helper (pipe_t *pipe_,
}
}
bool
zmq
::
mtrie_t
::
rm
(
unsigned
char
*
prefix_
,
size_t
size_
,
pipe_t
*
pipe_
)
bool
zmq
::
mtrie_t
::
rm
(
prefix_t
prefix_
,
size_t
size_
,
pipe_t
*
pipe_
)
{
return
rm_helper
(
prefix_
,
size_
,
pipe_
);
}
bool
zmq
::
mtrie_t
::
rm_helper
(
unsigned
char
*
prefix_
,
size_t
size_
,
pipe_t
*
pipe_
)
bool
zmq
::
mtrie_t
::
rm_helper
(
prefix_t
prefix_
,
size_t
size_
,
pipe_t
*
pipe_
)
{
if
(
!
size_
)
{
if
(
pipes
)
{
...
...
@@ -372,7 +366,7 @@ bool zmq::mtrie_t::rm_helper (unsigned char *prefix_,
return
ret
;
}
void
zmq
::
mtrie_t
::
match
(
unsigned
char
*
data_
,
void
zmq
::
mtrie_t
::
match
(
prefix_t
data_
,
size_t
size_
,
void
(
*
func_
)
(
pipe_t
*
pipe_
,
void
*
arg_
),
void
*
arg_
)
...
...
src/mtrie.hpp
View file @
9fc3692e
...
...
@@ -44,43 +44,45 @@ class pipe_t;
class
mtrie_t
{
public
:
typedef
const
unsigned
char
*
prefix_t
;
mtrie_t
();
~
mtrie_t
();
// Add key to the trie. Returns true if it's a new subscription
// rather than a duplicate.
bool
add
(
unsigned
char
*
prefix_
,
size_t
size_
,
zmq
::
pipe_t
*
pipe_
);
bool
add
(
prefix_t
prefix_
,
size_t
size_
,
zmq
::
pipe_t
*
pipe_
);
// Remove all subscriptions for a specific peer from the trie.
// The call_on_uniq_ flag controls if the callback is invoked
// when there are no subscriptions left on some topics or on
// every removal.
void
rm
(
zmq
::
pipe_t
*
pipe_
,
void
(
*
func_
)
(
unsigned
char
*
data_
,
size_t
size_
,
void
*
arg_
),
void
*
arg_
,
bool
call_on_uniq_
);
void
rm
(
zmq
::
pipe_t
*
pipe_
,
void
(
*
func_
)
(
const
unsigned
char
*
data_
,
size_t
size_
,
void
*
arg_
),
void
*
arg_
,
bool
call_on_uniq_
);
// Remove specific subscription from the trie. Return true is it was
// actually removed rather than de-duplicated.
bool
rm
(
unsigned
char
*
prefix_
,
size_t
size_
,
zmq
::
pipe_t
*
pipe_
);
bool
rm
(
prefix_t
prefix_
,
size_t
size_
,
zmq
::
pipe_t
*
pipe_
);
// Signal all the matching pipes.
void
match
(
unsigned
char
*
data_
,
void
match
(
prefix_t
data_
,
size_t
size_
,
void
(
*
func_
)
(
zmq
::
pipe_t
*
pipe_
,
void
*
arg_
),
void
*
arg_
);
private
:
bool
add_helper
(
unsigned
char
*
prefix_
,
size_t
size_
,
zmq
::
pipe_t
*
pipe_
);
void
rm_helper
(
zmq
::
pipe_t
*
pipe_
,
unsigned
char
**
buff_
,
size_t
buffsize_
,
size_t
maxbuffsize_
,
void
(
*
func_
)
(
unsigned
char
*
data_
,
size_t
size_
,
void
*
arg_
),
void
*
arg_
,
bool
call_on_uniq_
);
bool
rm_helper
(
unsigned
char
*
prefix_
,
size_t
size_
,
zmq
::
pipe_t
*
pipe_
);
bool
add_helper
(
prefix_t
prefix_
,
size_t
size_
,
zmq
::
pipe_t
*
pipe_
);
void
rm_helper
(
zmq
::
pipe_t
*
pipe_
,
unsigned
char
**
buff_
,
size_t
buffsize_
,
size_t
maxbuffsize_
,
void
(
*
func_
)
(
prefix_t
data_
,
size_t
size_
,
void
*
arg_
),
void
*
arg_
,
bool
call_on_uniq_
);
bool
rm_helper
(
prefix_t
prefix_
,
size_t
size_
,
zmq
::
pipe_t
*
pipe_
);
bool
is_redundant
()
const
;
typedef
std
::
set
<
zmq
::
pipe_t
*>
pipes_t
;
...
...
src/xpub.cpp
View file @
9fc3692e
...
...
@@ -188,7 +188,7 @@ int zmq::xpub_t::xsetsockopt (int option_,
return
0
;
}
static
void
stub
(
unsigned
char
*
data_
,
size_t
size_
,
void
*
arg_
)
static
void
stub
(
zmq
::
mtrie_t
::
prefix_t
data_
,
size_t
size_
,
void
*
arg_
)
{
LIBZMQ_UNUSED
(
data_
);
LIBZMQ_UNUSED
(
size_
);
...
...
@@ -295,7 +295,7 @@ bool zmq::xpub_t::xhas_in ()
return
!
pending_data
.
empty
();
}
void
zmq
::
xpub_t
::
send_unsubscription
(
unsigned
char
*
data_
,
void
zmq
::
xpub_t
::
send_unsubscription
(
zmq
::
mtrie_t
::
prefix_t
data_
,
size_t
size_
,
void
*
arg_
)
{
...
...
src/xpub.hpp
View file @
9fc3692e
...
...
@@ -66,8 +66,9 @@ class xpub_t : public socket_base_t
private
:
// Function to be applied to the trie to send all the subscriptions
// upstream.
static
void
send_unsubscription
(
unsigned
char
*
data_
,
size_t
size_
,
void
*
arg_
);
static
void
send_unsubscription
(
zmq
::
mtrie_t
::
prefix_t
data_
,
size_t
size_
,
void
*
arg_
);
// Function to be applied to each matching pipes.
static
void
mark_as_matching
(
zmq
::
pipe_t
*
pipe_
,
void
*
arg_
);
...
...
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