mirror of
https://github.com/zeromq/libzmq.git
synced 2025-11-06 21:56:25 +01:00
Problem: excessive memory allocations around blob_t (#2796)
* Problem: excessive memory allocations around blob_t Solution: redefine blob_t as a custom type, and use reference/move semantics where possible
This commit is contained in:
committed by
Luca Boccassi
parent
cfef04035c
commit
0897b3e07b
@@ -48,7 +48,7 @@ zmq::mechanism_t::~mechanism_t ()
|
||||
|
||||
void zmq::mechanism_t::set_peer_routing_id (const void *id_ptr, size_t id_size)
|
||||
{
|
||||
routing_id = blob_t (static_cast <const unsigned char*> (id_ptr), id_size);
|
||||
routing_id.set (static_cast <const unsigned char*> (id_ptr), id_size);
|
||||
}
|
||||
|
||||
void zmq::mechanism_t::peer_routing_id (msg_t *msg_)
|
||||
@@ -61,12 +61,12 @@ void zmq::mechanism_t::peer_routing_id (msg_t *msg_)
|
||||
|
||||
void zmq::mechanism_t::set_user_id (const void *data_, size_t size_)
|
||||
{
|
||||
user_id = blob_t (static_cast <const unsigned char*> (data_), size_);
|
||||
user_id.set (static_cast <const unsigned char*> (data_), size_);
|
||||
zap_properties.insert (metadata_t::dict_t::value_type (
|
||||
ZMQ_MSG_PROPERTY_USER_ID, std::string ((char *) data_, size_)));
|
||||
}
|
||||
|
||||
zmq::blob_t zmq::mechanism_t::get_user_id () const
|
||||
const zmq::blob_t &zmq::mechanism_t::get_user_id () const
|
||||
{
|
||||
return user_id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user