#define IS_ONCE_AFTER_N_RATE_POLICY(policy) \
(lttng_rate_policy_get_type(policy) == LTTNG_RATE_POLICY_TYPE_ONCE_AFTER_N)
-typedef void (*rate_policy_destroy_cb)(struct lttng_rate_policy *rate_policy);
-typedef int (*rate_policy_serialize_cb)(struct lttng_rate_policy *rate_policy,
- struct lttng_payload *payload);
-typedef bool (*rate_policy_equal_cb)(const struct lttng_rate_policy *a,
- const struct lttng_rate_policy *b);
-typedef ssize_t (*rate_policy_create_from_payload_cb)(struct lttng_payload_view *view,
- struct lttng_rate_policy **rate_policy);
-typedef struct lttng_rate_policy *(*rate_policy_copy_cb)(const struct lttng_rate_policy *source);
-typedef enum lttng_error_code (*rate_policy_mi_serialize_cb)(
- const struct lttng_rate_policy *rate_policy, struct mi_writer *writer);
+using rate_policy_destroy_cb = void (*)(struct lttng_rate_policy *);
+using rate_policy_serialize_cb = int (*)(struct lttng_rate_policy *, struct lttng_payload *);
+using rate_policy_equal_cb = bool (*)(const struct lttng_rate_policy *,
+ const struct lttng_rate_policy *);
+using rate_policy_create_from_payload_cb = ssize_t (*)(struct lttng_payload_view *,
+ struct lttng_rate_policy **);
+using rate_policy_copy_cb = struct lttng_rate_policy *(*) (const struct lttng_rate_policy *);
+using rate_policy_mi_serialize_cb = enum lttng_error_code (*)(const struct lttng_rate_policy *,
+ struct mi_writer *);
struct lttng_rate_policy {
enum lttng_rate_policy_type type;
struct lttng_rate_policy **rate_policy)
{
ssize_t consumed_len = -1;
- struct lttng_rate_policy *policy = NULL;
+ struct lttng_rate_policy *policy = nullptr;
const struct lttng_rate_policy_once_after_n_comm *comm;
const struct lttng_payload_view comm_view =
lttng_payload_view_from_view(view, 0, sizeof(*comm));
comm = (const struct lttng_rate_policy_once_after_n_comm *) comm_view.buffer.data;
policy = lttng_rate_policy_once_after_n_create(comm->threshold);
- if (policy == NULL) {
+ if (policy == nullptr) {
consumed_len = -1;
goto end;
}
struct lttng_rate_policy **rate_policy)
{
ssize_t consumed_len = -1;
- struct lttng_rate_policy *policy = NULL;
+ struct lttng_rate_policy *policy = nullptr;
const struct lttng_rate_policy_every_n_comm *comm;
const struct lttng_payload_view comm_view =
lttng_payload_view_from_view(view, 0, sizeof(*comm));
comm = (const struct lttng_rate_policy_every_n_comm *) comm_view.buffer.data;
policy = lttng_rate_policy_every_n_create(comm->interval);
- if (policy == NULL) {
+ if (policy == nullptr) {
consumed_len = -1;
goto end;
}
static struct lttng_rate_policy *
lttng_rate_policy_every_n_copy(const struct lttng_rate_policy *source)
{
- struct lttng_rate_policy *copy = NULL;
+ struct lttng_rate_policy *copy = nullptr;
const struct lttng_rate_policy_every_n *every_n_policy;
if (!source) {
{
int ret;
enum lttng_error_code ret_code;
- const struct lttng_rate_policy_every_n *every_n_policy = NULL;
+ const struct lttng_rate_policy_every_n *every_n_policy = nullptr;
LTTNG_ASSERT(rate_policy);
LTTNG_ASSERT(IS_EVERY_N_RATE_POLICY(rate_policy));
struct lttng_rate_policy *lttng_rate_policy_every_n_create(uint64_t interval)
{
- struct lttng_rate_policy_every_n *policy = NULL;
- struct lttng_rate_policy *_policy = NULL;
+ struct lttng_rate_policy_every_n *policy = nullptr;
+ struct lttng_rate_policy *_policy = nullptr;
if (interval == 0) {
/*
policy->interval = interval;
_policy = &policy->parent;
- policy = NULL;
+ policy = nullptr;
end:
free(policy);
static struct lttng_rate_policy *
lttng_rate_policy_once_after_n_copy(const struct lttng_rate_policy *source)
{
- struct lttng_rate_policy *copy = NULL;
+ struct lttng_rate_policy *copy = nullptr;
const struct lttng_rate_policy_once_after_n *once_after_n_policy;
if (!source) {
{
int ret;
enum lttng_error_code ret_code;
- const struct lttng_rate_policy_once_after_n *once_after_n_policy = NULL;
+ const struct lttng_rate_policy_once_after_n *once_after_n_policy = nullptr;
LTTNG_ASSERT(rate_policy);
LTTNG_ASSERT(IS_ONCE_AFTER_N_RATE_POLICY(rate_policy));
struct lttng_rate_policy *lttng_rate_policy_once_after_n_create(uint64_t threshold)
{
- struct lttng_rate_policy_once_after_n *policy = NULL;
- struct lttng_rate_policy *_policy = NULL;
+ struct lttng_rate_policy_once_after_n *policy = nullptr;
+ struct lttng_rate_policy *_policy = nullptr;
if (threshold == 0) {
/* threshold is expected to be > 0 */
policy->threshold = threshold;
_policy = &policy->parent;
- policy = NULL;
+ policy = nullptr;
end:
free(policy);