X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=tests%2Fregression%2Ftools%2Flive%2Flive_test.cpp;h=559b9a7b1e8298885ae574090a26683e6058eb82;hb=f149493493fbd8a3efa4748832c03278c96c38ca;hp=76d801e9b024ee3fcbcd78e6722dbe0e762fd361;hpb=f46376a14da2eb796690cb4e718e8b213839d6ea;p=lttng-tools.git diff --git a/tests/regression/tools/live/live_test.cpp b/tests/regression/tools/live/live_test.cpp index 76d801e9b..559b9a7b1 100644 --- a/tests/regression/tools/live/live_test.cpp +++ b/tests/regression/tools/live/live_test.cpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include #include @@ -24,13 +24,13 @@ #include #include -#include +#include -#include -#include +#include +#include -#include -#include +#include +#include #define SESSION1 "test1" #define RELAYD_URL "net://localhost" @@ -46,12 +46,13 @@ LTTNG_EXPORT DEFINE_LTTNG_UST_SIGBUS_STATE(); #endif -static int control_sock; +namespace { struct live_session *session; +int control_sock; -static int first_packet_offset; -static int first_packet_len; -static int first_packet_stream_id = -1; +int first_packet_offset; +int first_packet_len; +int first_packet_stream_id = -1; struct viewer_stream { uint64_t id; @@ -68,6 +69,7 @@ struct live_session { uint64_t live_timer_interval; uint64_t stream_count; }; +} /* namespace */ static ssize_t lttng_live_recv(int fd, void *buf, size_t len) @@ -285,7 +287,7 @@ int attach_session(uint64_t id) int i; ssize_t ret_len; - session = (live_session *) zmalloc(sizeof(struct live_session)); + session = zmalloc(); if (!session) { goto error; } @@ -327,8 +329,7 @@ int attach_session(uint64_t id) diag("Got session stream count == 0"); goto error; } - session->streams = (viewer_stream *) zmalloc(session->stream_count * - sizeof(struct viewer_stream)); + session->streams = calloc(session->stream_count); if (!session->streams) { goto error; } @@ -436,7 +437,7 @@ retry: goto error; } - data = (char *) zmalloc(len); + data = calloc(len); if (!data) { PERROR("relay data zmalloc"); goto error;