mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-28 19:52:00 +01:00
Problem: code duplication in getsockopt/setsockopt
Solution: extracted common code into do_getsockopt/do_setsockopt functions
This commit is contained in:
@@ -59,10 +59,7 @@ int zmq::sub_t::xsetsockopt (int option_,
|
||||
int rc = msg.init_size (optvallen_ + 1);
|
||||
errno_assert (rc == 0);
|
||||
unsigned char *data = (unsigned char *) msg.data ();
|
||||
if (option_ == ZMQ_SUBSCRIBE)
|
||||
*data = 1;
|
||||
else if (option_ == ZMQ_UNSUBSCRIBE)
|
||||
*data = 0;
|
||||
*data = (option_ == ZMQ_SUBSCRIBE);
|
||||
// We explicitly allow a NULL subscription with size zero
|
||||
if (optvallen_) {
|
||||
assert (optval_);
|
||||
|
||||
Reference in New Issue
Block a user