Problem: formatting errors

Solution: run make clang-format-diff
This commit is contained in:
Luca Boccassi 2021-09-21 19:11:11 +01:00
parent 11f0802912
commit 0f706bdd97
35 changed files with 59 additions and 103 deletions

View File

@ -249,7 +249,7 @@ typedef struct zmq_msg_t
#endif
} zmq_msg_t;
typedef void(zmq_free_fn) (void *data_, void *hint_);
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_);
@ -583,7 +583,7 @@ ZMQ_EXPORT void zmq_atomic_counter_destroy (void **counter_p_);
#define ZMQ_HAVE_TIMERS
typedef void(zmq_timer_fn) (int timer_id, void *arg);
typedef void (zmq_timer_fn) (int timer_id, void *arg);
ZMQ_EXPORT void *zmq_timers_new (void);
ZMQ_EXPORT int zmq_timers_destroy (void **timers_p);
@ -620,7 +620,7 @@ ZMQ_EXPORT unsigned long zmq_stopwatch_stop (void *watch_);
/* Sleeps for specified number of seconds. */
ZMQ_EXPORT void zmq_sleep (int seconds_);
typedef void(zmq_thread_fn) (void *);
typedef void (zmq_thread_fn) (void *);
/* Start a thread. Returns a handle to the thread. */
ZMQ_EXPORT void *zmq_threadstart (zmq_thread_fn *func_, void *arg_);

View File

@ -48,9 +48,7 @@
zmq::address_t::address_t (const std::string &protocol_,
const std::string &address_,
ctx_t *parent_) :
protocol (protocol_),
address (address_),
parent (parent_)
protocol (protocol_), address (address_), parent (parent_)
{
resolved.dummy = NULL;
}

View File

@ -100,9 +100,7 @@ struct blob_t
// Use with caution and ensure that the blob_t will not outlive
// the referenced data.
blob_t (unsigned char *const data_, const size_t size_, reference_tag_t) :
_data (data_),
_size (size_),
_owned (false)
_data (data_), _size (size_), _owned (false)
{
}

View File

@ -35,8 +35,7 @@
#include "msg.hpp"
zmq::channel_t::channel_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
socket_base_t (parent_, tid_, sid_, true),
_pipe (NULL)
socket_base_t (parent_, tid_, sid_, true), _pipe (NULL)
{
options.type = ZMQ_CHANNEL;
}

View File

@ -34,8 +34,7 @@
#include "msg.hpp"
zmq::dealer_t::dealer_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
socket_base_t (parent_, tid_, sid_),
_probe_router (false)
socket_base_t (parent_, tid_, sid_), _probe_router (false)
{
options.type = ZMQ_DEALER;
options.can_send_hello_msg = true;

View File

@ -58,10 +58,7 @@ class decoder_base_t : public i_decoder
{
public:
explicit decoder_base_t (const size_t buf_size_) :
_next (NULL),
_read_pos (NULL),
_to_read (0),
_allocator (buf_size_)
_next (NULL), _read_pos (NULL), _to_read (0), _allocator (buf_size_)
{
_buf = _allocator.allocate ();
}

View File

@ -37,9 +37,7 @@
#include "err.hpp"
zmq::dgram_t::dgram_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
socket_base_t (parent_, tid_, sid_),
_pipe (NULL),
_more_out (false)
socket_base_t (parent_, tid_, sid_), _pipe (NULL), _more_out (false)
{
options.type = ZMQ_DGRAM;
options.raw_socket = true;

View File

@ -35,8 +35,7 @@
#include "err.hpp"
zmq::dish_t::dish_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
socket_base_t (parent_, tid_, sid_, true),
_has_message (false)
socket_base_t (parent_, tid_, sid_, true), _has_message (false)
{
options.type = ZMQ_DISH;

View File

@ -35,10 +35,7 @@
#include "likely.hpp"
zmq::dist_t::dist_t () :
_matching (0),
_active (0),
_eligible (0),
_more (false)
_matching (0), _active (0), _eligible (0), _more (false)
{
}

View File

@ -47,9 +47,7 @@ struct endpoint_uri_pair_t
endpoint_uri_pair_t (const std::string &local,
const std::string &remote,
endpoint_type_t local_type) :
local (local),
remote (remote),
local_type (local_type)
local (local), remote (remote), local_type (local_type)
{
}

View File

@ -45,10 +45,7 @@ namespace zmq
{
template <typename T>
generic_mtrie_t<T>::generic_mtrie_t () :
_pipes (0),
_min (0),
_count (0),
_live_nodes (0)
_pipes (0), _min (0), _count (0), _live_nodes (0)
{
}

View File

@ -78,8 +78,7 @@
zmq::ipc_listener_t::ipc_listener_t (io_thread_t *io_thread_,
socket_base_t *socket_,
const options_t &options_) :
stream_listener_base_t (io_thread_, socket_, options_),
_has_file (false)
stream_listener_base_t (io_thread_, socket_, options_), _has_file (false)
{
}

View File

@ -34,8 +34,7 @@
zmq::mechanism_base_t::mechanism_base_t (session_base_t *const session_,
const options_t &options_) :
mechanism_t (options_),
session (session_)
mechanism_t (options_), session (session_)
{
}

View File

@ -46,7 +46,7 @@
// Note that it has to be declared as "C" so that it is the same as
// zmq_free_fn defined in zmq.h.
extern "C" {
typedef void(msg_free_fn) (void *data_, void *hint_);
typedef void (msg_free_fn) (void *data_, void *hint_);
}
namespace zmq

View File

@ -44,8 +44,7 @@ zmq::object_t::object_t (ctx_t *ctx_, uint32_t tid_) : _ctx (ctx_), _tid (tid_)
}
zmq::object_t::object_t (object_t *parent_) :
_ctx (parent_->_ctx),
_tid (parent_->_tid)
_ctx (parent_->_ctx), _tid (parent_->_tid)
{
}

View File

@ -35,8 +35,7 @@
#include "msg.hpp"
zmq::pair_t::pair_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
socket_base_t (parent_, tid_, sid_),
_pipe (NULL)
socket_base_t (parent_, tid_, sid_), _pipe (NULL)
{
options.type = ZMQ_PAIR;
}

View File

@ -41,8 +41,7 @@
zmq::plain_client_t::plain_client_t (session_base_t *const session_,
const options_t &options_) :
mechanism_base_t (session_, options_),
_state (sending_hello)
mechanism_base_t (session_, options_), _state (sending_hello)
{
}

View File

@ -42,8 +42,7 @@
#include "i_poll_events.hpp"
zmq::poll_t::poll_t (const zmq::thread_ctx_t &ctx_) :
worker_poller_base_t (ctx_),
retired (false)
worker_poller_base_t (ctx_), retired (false)
{
}

View File

@ -82,7 +82,7 @@ template <typename T, size_t S> class resizable_fast_vector_t
_dynamic_buf = new (std::nothrow) std::vector<T> (nitems_);
// TODO since this function is called by a client, we could return errno == ENOMEM here
alloc_assert (_dynamic_buf);
memcpy(&(*_dynamic_buf)[0], _static_buf, sizeof _static_buf);
memcpy (&(*_dynamic_buf)[0], _static_buf, sizeof _static_buf);
}
}

View File

@ -43,8 +43,7 @@
#include "i_poll_events.hpp"
zmq::pollset_t::pollset_t (const zmq::thread_ctx_t &ctx_) :
ctx (ctx_),
stopping (false)
ctx (ctx_), stopping (false)
{
pollset_fd = pollset_create (-1);
errno_assert (pollset_fd != -1);

View File

@ -37,8 +37,7 @@
#include "msg.hpp"
zmq::radio_t::radio_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
socket_base_t (parent_, tid_, sid_, true),
_lossy (true)
socket_base_t (parent_, tid_, sid_, true), _lossy (true)
{
options.type = ZMQ_RADIO;
}

View File

@ -477,8 +477,8 @@ zmq::select_t::fds_set_t::fds_set_t (const fds_set_t &other_)
#endif
}
zmq::select_t::fds_set_t &zmq::select_t::fds_set_t::
operator= (const fds_set_t &other_)
zmq::select_t::fds_set_t &
zmq::select_t::fds_set_t::operator= (const fds_set_t &other_)
{
#if defined ZMQ_HAVE_WINDOWS
// On Windows we don't need to copy the whole fd_set.

View File

@ -804,13 +804,11 @@ int zmq::socket_base_t::connect_internal (const char *endpoint_uri_)
// The total HWM for an inproc connection should be the sum of
// the binder's HWM and the connector's HWM.
const int sndhwm = peer.socket == NULL
? options.sndhwm
const int sndhwm = peer.socket == NULL ? options.sndhwm
: options.sndhwm != 0 && peer.options.rcvhwm != 0
? options.sndhwm + peer.options.rcvhwm
: 0;
const int rcvhwm = peer.socket == NULL
? options.rcvhwm
const int rcvhwm = peer.socket == NULL ? options.rcvhwm
: options.rcvhwm != 0 && peer.options.sndhwm != 0
? options.rcvhwm + peer.options.sndhwm
: 0;

View File

@ -55,8 +55,7 @@ zmq::socks_greeting_t::socks_greeting_t (const uint8_t *methods_,
}
zmq::socks_greeting_encoder_t::socks_greeting_encoder_t () :
_bytes_encoded (0),
_bytes_written (0)
_bytes_encoded (0), _bytes_written (0)
{
}
@ -131,8 +130,7 @@ void zmq::socks_choice_decoder_t::reset ()
zmq::socks_basic_auth_request_t::socks_basic_auth_request_t (
const std::string &username_, const std::string &password_) :
username (username_),
password (password_)
username (username_), password (password_)
{
zmq_assert (username_.size () <= UINT8_MAX);
zmq_assert (password_.size () <= UINT8_MAX);
@ -140,8 +138,7 @@ zmq::socks_basic_auth_request_t::socks_basic_auth_request_t (
zmq::socks_basic_auth_request_encoder_t::socks_basic_auth_request_encoder_t () :
_bytes_encoded (0),
_bytes_written (0)
_bytes_encoded (0), _bytes_written (0)
{
}
@ -223,16 +220,13 @@ void zmq::socks_auth_response_decoder_t::reset ()
zmq::socks_request_t::socks_request_t (uint8_t command_,
std::string hostname_,
uint16_t port_) :
command (command_),
hostname (ZMQ_MOVE (hostname_)),
port (port_)
command (command_), hostname (ZMQ_MOVE (hostname_)), port (port_)
{
zmq_assert (hostname.size () <= UINT8_MAX);
}
zmq::socks_request_encoder_t::socks_request_encoder_t () :
_bytes_encoded (0),
_bytes_written (0)
_bytes_encoded (0), _bytes_written (0)
{
}
@ -308,9 +302,7 @@ void zmq::socks_request_encoder_t::reset ()
zmq::socks_response_t::socks_response_t (uint8_t response_code_,
const std::string &address_,
uint16_t port_) :
response_code (response_code_),
address (address_),
port (port_)
response_code (response_code_), address (address_), port (port_)
{
}

View File

@ -279,7 +279,7 @@ void zmq::thread_t::stop ()
bool zmq::thread_t::is_current_thread () const
{
return bool(pthread_equal (pthread_self (), _descriptor));
return bool (pthread_equal (pthread_self (), _descriptor));
}
void zmq::thread_t::setSchedulingParameters (

View File

@ -41,7 +41,7 @@
namespace zmq
{
typedef void(thread_fn) (void *);
typedef void (thread_fn) (void *);
// Class encapsulating OS thread. Thread initiation/termination is done
// using special functions rather than in constructor/destructor so that

View File

@ -38,7 +38,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace zmq
{
typedef void(timers_timer_fn) (int timer_id_, void *arg_);
typedef void (timers_timer_fn) (int timer_id_, void *arg_);
class timers_t
{

View File

@ -46,8 +46,7 @@
#endif
zmq::udp_address_t::udp_address_t () :
_bind_interface (-1),
_is_multicast (false)
_bind_interface (-1), _is_multicast (false)
{
_bind_address = ip_addr_t::any (AF_INET);
_target_address = ip_addr_t::any (AF_INET);

View File

@ -40,8 +40,7 @@
#include "err.hpp"
zmq::v1_decoder_t::v1_decoder_t (size_t bufsize_, int64_t maxmsgsize_) :
decoder_base_t<v1_decoder_t> (bufsize_),
_max_msg_size (maxmsgsize_)
decoder_base_t<v1_decoder_t> (bufsize_), _max_msg_size (maxmsgsize_)
{
int rc = _in_progress.init ();
errno_assert (rc == 0);

View File

@ -38,8 +38,7 @@
#include <limits.h>
zmq::ws_encoder_t::ws_encoder_t (size_t bufsize_, bool must_mask_) :
encoder_base_t<ws_encoder_t> (bufsize_),
_must_mask (must_mask_)
encoder_base_t<ws_encoder_t> (bufsize_), _must_mask (must_mask_)
{
// Write 0 bytes to the batch and go to message_ready state.
next_step (NULL, 0, &ws_encoder_t::message_ready, true);

View File

@ -70,8 +70,7 @@ zmq::ws_listener_t::ws_listener_t (io_thread_t *io_thread_,
socket_base_t *socket_,
const options_t &options_,
bool wss_) :
stream_listener_base_t (io_thread_, socket_, options_),
_wss (wss_)
stream_listener_base_t (io_thread_, socket_, options_), _wss (wss_)
{
#ifdef ZMQ_HAVE_WSS
if (_wss) {

View File

@ -44,8 +44,7 @@ const size_t id_len = sizeof (id) - 1;
zap_client_t::zap_client_t (session_base_t *const session_,
const std::string &peer_address_,
const options_t &options_) :
mechanism_base_t (session_, options_),
peer_address (peer_address_)
mechanism_base_t (session_, options_), peer_address (peer_address_)
{
}

View File

@ -383,9 +383,9 @@ fd_t connect_socket (const char *endpoint_, const int af_, const int protocol_)
// OSX is very opinionated and wants the size to match the AF family type
socklen_t addr_len;
const fd_t s_pre = socket (af_, SOCK_STREAM,
protocol_ == IPPROTO_UDP
? IPPROTO_UDP
: protocol_ == IPPROTO_TCP ? IPPROTO_TCP : 0);
protocol_ == IPPROTO_UDP ? IPPROTO_UDP
: protocol_ == IPPROTO_TCP ? IPPROTO_TCP
: 0);
TEST_ASSERT_NOT_EQUAL (-1, s_pre);
if (af_ == AF_INET || af_ == AF_INET6) {
@ -440,9 +440,9 @@ fd_t bind_socket_resolve_port (const char *address_,
// OSX is very opinionated and wants the size to match the AF family type
socklen_t addr_len;
const fd_t s_pre = socket (af_, SOCK_STREAM,
protocol_ == IPPROTO_UDP
? IPPROTO_UDP
: protocol_ == IPPROTO_TCP ? IPPROTO_TCP : 0);
protocol_ == IPPROTO_UDP ? IPPROTO_UDP
: protocol_ == IPPROTO_TCP ? IPPROTO_TCP
: 0);
TEST_ASSERT_NOT_EQUAL (-1, s_pre);
if (af_ == AF_INET || af_ == AF_INET6) {
@ -511,11 +511,10 @@ fd_t bind_socket_resolve_port (const char *address_,
TEST_ASSERT_SUCCESS_RAW_ERRNO (
getsockname (s_pre, (struct sockaddr *) &addr, &addr_len));
sprintf (my_endpoint_, "%s://%s:%u",
protocol_ == IPPROTO_TCP
? "tcp"
: protocol_ == IPPROTO_UDP
? "udp"
: protocol_ == IPPROTO_WSS ? "wss" : "ws",
protocol_ == IPPROTO_TCP ? "tcp"
: protocol_ == IPPROTO_UDP ? "udp"
: protocol_ == IPPROTO_WSS ? "wss"
: "ws",
address_,
af_ == AF_INET
? ntohs ((*(struct sockaddr_in *) &addr).sin_port)

View File

@ -35,7 +35,7 @@
// security test utils
typedef void(socket_config_fn) (void *, void *);
typedef void (socket_config_fn) (void *, void *);
// NULL specific functions
void socket_config_null_client (void *server_, void *server_secret_);