Reduced number of calls to container end method

This commit is contained in:
Simon Giesecke
2018-08-08 21:21:56 +02:00
parent 05e400a3e0
commit 9e2cf35b66
13 changed files with 88 additions and 64 deletions

View File

@@ -178,12 +178,14 @@ size_t zmq::mechanism_t::add_basic_properties (unsigned char *ptr_,
}
for (std::map<std::string, std::string>::const_iterator it =
options.app_metadata.begin ();
it != options.app_metadata.end (); ++it)
for (std::map<std::string, std::string>::const_iterator
it = options.app_metadata.begin (),
end = options.app_metadata.end ();
it != end; ++it) {
ptr +=
add_property (ptr, ptr_capacity_ - (ptr - ptr_), it->first.c_str (),
it->second.c_str (), strlen (it->second.c_str ()));
}
return ptr - ptr_;
}
@@ -193,9 +195,10 @@ size_t zmq::mechanism_t::basic_properties_len () const
const char *socket_type = socket_type_string (options.type);
size_t meta_len = 0;
for (std::map<std::string, std::string>::const_iterator it =
options.app_metadata.begin ();
it != options.app_metadata.end (); ++it) {
for (std::map<std::string, std::string>::const_iterator
it = options.app_metadata.begin (),
end = options.app_metadata.end ();
it != end; ++it) {
meta_len +=
property_len (it->first.c_str (), strlen (it->second.c_str ()));
}