#include <limits.h>
#include <unistd.h>
#include <inttypes.h>
-#include <common/common.h>
-#include <common/time.h>
+#include <common/common.hpp>
+#include <common/time.hpp>
-#include "ust-registry.h"
-#include "ust-clock.h"
-#include "ust-app.h"
-
-#ifndef max_t
-#define max_t(type, a, b) ((type) ((a) > (b) ? (a) : (b)))
-#endif
+#include "ust-registry.hpp"
+#include "ust-clock.hpp"
+#include "ust-app.hpp"
#define NR_CLOCK_OFFSET_SAMPLES 10
char *newptr;
new_alloc_len =
- max_t(size_t, 1U << get_count_order(new_alloc_len), old_alloc_len << 1);
+ std::max<size_t>(1U << get_count_order(new_alloc_len), old_alloc_len << 1);
newptr = (char *) realloc(session->metadata, new_alloc_len);
if (!newptr)
return -ENOMEM;
int ret;
char identifier[LTTNG_UST_ABI_SYM_NAME_LEN];
- if (variant->type.atype != lttng_ust_ctl_atype_variant) {
- ret = -EINVAL;
- goto end;
- }
(*iter_field)++;
sanitize_ctf_identifier(identifier, tag_name);
if (alignment) {
int ust_metadata_channel_statedump(struct ust_registry_session *session,
struct ust_registry_channel *chan)
{
- int ret = 0;
+ int ret;
/* Don't dump metadata events */
if (chan->chan_id == -1U)
"struct event_header_compact" :
"struct event_header_large");
if (ret) {
- goto end;
+ return ret;
}
if (chan->ctx_fields) {
ret = lttng_metadata_printf(session,
" event.context := struct {\n");
if (ret) {
- goto end;
+ return ret;
}
}
ret = _lttng_context_metadata_statedump(session,
chan->nr_ctx_fields,
chan->ctx_fields);
if (ret) {
- goto end;
+ return ret;
}
if (chan->ctx_fields) {
ret = lttng_metadata_printf(session,
" };\n");
if (ret) {
- goto end;
+ return ret;
}
}
ret = lttng_metadata_printf(session,
"};\n\n");
+ if (ret) {
+ return ret;
+ }
+
/* Flag success of metadata dump. */
chan->metadata_dumped = 1;
-end:
- return ret;
+ return 0;
}
static