#include <urcu.h>
#include <urcu/compiler.h>
-#include <common/common.h>
-#include <common/defaults.h>
+#include <common/common.hpp>
+#include <common/defaults.hpp>
-#include "hashtable.h"
-#include "utils.h"
+#include "hashtable.hpp"
+#include "utils.hpp"
/* seed_lock protects both seed_init and lttng_ht_seed. */
static pthread_mutex_t seed_lock = PTHREAD_MUTEX_INITIALIZER;
static bool seed_init;
-unsigned long lttng_ht_seed;
static unsigned long min_hash_alloc_size = 1;
static unsigned long max_hash_buckets_size = 0;
static int match_str(struct cds_lfht_node *node, const void *key)
{
struct lttng_ht_node_str *match_node =
- caa_container_of(node, struct lttng_ht_node_str, node);
+ lttng::utils::container_of(node, <tng_ht_node_str::node);
return hash_match_key_str(match_node->key, (void *) key);
}
static int match_ulong(struct cds_lfht_node *node, const void *key)
{
struct lttng_ht_node_ulong *match_node =
- caa_container_of(node, struct lttng_ht_node_ulong, node);
+ lttng::utils::container_of(node, <tng_ht_node_ulong::node);
return hash_match_key_ulong((void *) match_node->key, (void *) key);
}
static int match_u64(struct cds_lfht_node *node, const void *key)
{
struct lttng_ht_node_u64 *match_node =
- caa_container_of(node, struct lttng_ht_node_u64, node);
+ lttng::utils::container_of(node, <tng_ht_node_u64::node);
return hash_match_key_u64(&match_node->key, (void *) key);
}
static int match_two_u64(struct cds_lfht_node *node, const void *key)
{
struct lttng_ht_node_two_u64 *match_node =
- caa_container_of(node, struct lttng_ht_node_two_u64, node);
+ lttng::utils::container_of(node, <tng_ht_node_two_u64::node);
return hash_match_key_two_u64((void *) &match_node->key, (void *) key);
}
}
pthread_mutex_unlock(&seed_lock);
- ht = (lttng_ht *) zmalloc(sizeof(*ht));
+ ht = zmalloc<lttng_ht>();
if (ht == NULL) {
PERROR("zmalloc lttng_ht");
goto error;
if (!node_ptr) {
return NULL;
} else {
- return caa_container_of(node_ptr, struct lttng_ht_node_ulong, node);
+ return lttng::utils::container_of(node_ptr, <tng_ht_node_ulong::node);
}
LTTNG_ASSERT(node_ptr == &node->node);
}
if (!node_ptr) {
return NULL;
} else {
- return caa_container_of(node_ptr, struct lttng_ht_node_u64, node);
+ return lttng::utils::container_of(node_ptr, <tng_ht_node_u64::node);
}
LTTNG_ASSERT(node_ptr == &node->node);
}
if (!node) {
return NULL;
}
- return caa_container_of(node, struct lttng_ht_node_str, node);
+ return lttng::utils::container_of(node, <tng_ht_node_str::node);
}
/*
if (!node) {
return NULL;
}
- return caa_container_of(node, struct lttng_ht_node_ulong, node);
+ return lttng::utils::container_of(node, <tng_ht_node_ulong::node);
}
/*
if (!node) {
return NULL;
}
- return caa_container_of(node, struct lttng_ht_node_u64, node);
+ return lttng::utils::container_of(node, <tng_ht_node_u64::node);
}
/*
if (!node) {
return NULL;
}
- return caa_container_of(node, struct lttng_ht_node_two_u64, node);
+ return lttng::utils::container_of(node, <tng_ht_node_two_u64::node);
}