*/
static xmlChar *encode_string(const char *in_str)
{
- xmlChar *out_str = NULL;
+ xmlChar *out_str = nullptr;
xmlCharEncodingHandlerPtr handler;
int out_len, ret, in_len;
ret = handler->input(out_str, &out_len, (const xmlChar *) in_str, &in_len);
if (ret < 0) {
xmlFree(out_str);
- out_str = NULL;
+ out_str = nullptr;
goto end;
}
goto end;
}
- buffer = xmlOutputBufferCreateFd(fd_output, NULL);
+ buffer = xmlOutputBufferCreateFd(fd_output, nullptr);
if (!buffer) {
goto error_destroy;
}
writer->writer = xmlNewTextWriter(buffer);
- ret = xmlTextWriterStartDocument(writer->writer, NULL, config_xml_encoding, NULL);
+ ret = xmlTextWriterStartDocument(writer->writer, nullptr, config_xml_encoding, nullptr);
if (ret < 0) {
goto error_destroy;
}
return writer;
error_destroy:
config_writer_destroy(writer);
- return NULL;
+ return nullptr;
}
int config_writer_destroy(struct config_writer *writer)
int config_writer_write_attribute(struct config_writer *writer, const char *name, const char *value)
{
int ret;
- xmlChar *encoded_name = NULL;
- xmlChar *encoded_value = NULL;
+ xmlChar *encoded_name = nullptr;
+ xmlChar *encoded_value = nullptr;
if (!writer || !writer->writer || !name || !name[0]) {
ret = -1;
const char *value)
{
int ret;
- xmlChar *encoded_element_name = NULL;
- xmlChar *encoded_value = NULL;
+ xmlChar *encoded_element_name = nullptr;
+ xmlChar *encoded_value = nullptr;
if (!writer || !writer->writer || !element_name || !element_name[0] || !value) {
ret = -1;
memset(ctx, 0, sizeof(struct session_config_validation_ctx));
}
-static char *get_session_config_xsd_path(void)
+static char *get_session_config_xsd_path()
{
char *xsd_path;
const char *base_path = lttng_secure_getenv(DEFAULT_SESSION_CONFIG_XSD_PATH_ENV);
ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
goto end;
}
- xmlSchemaSetParserErrors(ctx->parser_ctx, xml_error_handler, xml_error_handler, NULL);
+ xmlSchemaSetParserErrors(ctx->parser_ctx, xml_error_handler, xml_error_handler, nullptr);
ctx->schema = xmlSchemaParse(ctx->parser_ctx);
if (!ctx->schema) {
}
xmlSchemaSetValidErrors(
- ctx->schema_validation_ctx, xml_error_handler, xml_error_handler, NULL);
+ ctx->schema_validation_ctx, xml_error_handler, xml_error_handler, nullptr);
ret = 0;
end:
{
int ret;
enum lttng_error_code ret_code;
- xmlNodePtr node = NULL;
+ xmlNodePtr node = nullptr;
xmlNodePtr snapshot_output_list_node;
xmlNodePtr snapshot_output_node;
struct lttng_session_descriptor *session_descriptor = nullptr;
for (snapshot_output_node = xmlFirstElementChild(snapshot_output_list_node);
snapshot_output_node;
snapshot_output_node = xmlNextElementSibling(snapshot_output_node)) {
- char *name = NULL;
+ char *name = nullptr;
uint64_t max_size = UINT64_MAX;
struct consumer_output output = {};
- struct lttng_snapshot_output *snapshot_output = NULL;
- const char *control_uri = NULL;
- const char *data_uri = NULL;
- const char *path = NULL;
+ struct lttng_snapshot_output *snapshot_output = nullptr;
+ const char *control_uri = nullptr;
+ const char *data_uri = nullptr;
+ const char *path = nullptr;
for (node = xmlFirstElementChild(snapshot_output_node); node;
node = xmlNextElementSibling(node)) {
if (overrides->path_url) {
path = overrides->path_url;
/* Control/data_uri are null */
- control_uri = NULL;
- data_uri = NULL;
+ control_uri = nullptr;
+ data_uri = nullptr;
} else {
if (overrides->ctrl_url) {
control_uri = overrides->ctrl_url;
/* path is null */
- path = NULL;
+ path = nullptr;
}
if (overrides->data_url) {
data_uri = overrides->data_url;
/* path is null */
- path = NULL;
+ path = nullptr;
}
}
}
enum lttng_error_code ret_code;
struct consumer_output output = {};
xmlNodePtr consumer_output_node;
- const char *control_uri = NULL;
- const char *data_uri = NULL;
- const char *path = NULL;
+ const char *control_uri = nullptr;
+ const char *data_uri = nullptr;
+ const char *path = nullptr;
struct lttng_session_descriptor *session_descriptor = nullptr;
LTTNG_ASSERT(name);
}
if (strcmp((const char *) consumer_output_node->name,
- config_element_consumer_output)) {
+ config_element_consumer_output) != 0) {
WARN("Invalid output type, expected %s node",
config_element_consumer_output);
ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
if (overrides->path_url) {
path = overrides->path_url;
/* control/data_uri are null */;
- control_uri = NULL;
- data_uri = NULL;
+ control_uri = nullptr;
+ data_uri = nullptr;
} else {
if (overrides->ctrl_url) {
control_uri = overrides->ctrl_url;
/* path is null */
- path = NULL;
+ path = nullptr;
}
if (overrides->data_url) {
data_uri = overrides->data_url;
/* path is null */
- path = NULL;
+ path = nullptr;
}
}
}
process_userspace_probe_function_attribute_node(xmlNodePtr attribute_node)
{
xmlNodePtr function_attribute_node;
- char *function_name = NULL, *binary_path = NULL;
- struct lttng_userspace_probe_location *location = NULL;
- struct lttng_userspace_probe_location_lookup_method *lookup_method = NULL;
+ char *function_name = nullptr, *binary_path = nullptr;
+ struct lttng_userspace_probe_location *location = nullptr;
+ struct lttng_userspace_probe_location_lookup_method *lookup_method = nullptr;
/*
* Process userspace probe location function attributes. The order of
/* Ownership of lookup_method is transferred. */
location = lttng_userspace_probe_location_function_create(
binary_path, function_name, lookup_method);
- lookup_method = NULL;
+ lookup_method = nullptr;
goto error;
}
}
process_userspace_probe_tracepoint_attribute_node(xmlNodePtr attribute_node)
{
xmlNodePtr tracepoint_attribute_node;
- char *probe_name = NULL, *provider_name = NULL, *binary_path = NULL;
- struct lttng_userspace_probe_location *location = NULL;
- struct lttng_userspace_probe_location_lookup_method *lookup_method = NULL;
+ char *probe_name = nullptr, *provider_name = nullptr, *binary_path = nullptr;
+ struct lttng_userspace_probe_location *location = nullptr;
+ struct lttng_userspace_probe_location_lookup_method *lookup_method = nullptr;
/*
* Process userspace probe location tracepoint attributes. The order of
/* Ownership of lookup_method is transferred. */
location = lttng_userspace_probe_location_tracepoint_create(
binary_path, provider_name, probe_name, lookup_method);
- lookup_method = NULL;
+ lookup_method = nullptr;
goto error;
}
}
int ret = 0, i;
xmlNodePtr node;
struct lttng_event *event;
- char **exclusions = NULL;
+ char **exclusions = nullptr;
unsigned long exclusion_count = 0;
- char *filter_expression = NULL;
+ char *filter_expression = nullptr;
LTTNG_ASSERT(event_node);
LTTNG_ASSERT(handle);
memset(&event, 0, sizeof(event));
event.loglevel = -1;
event.type = LTTNG_EVENT_ALL;
- ret = lttng_disable_event_ext(handle, &event, channel_name, NULL);
+ ret = lttng_disable_event_ext(handle, &event, channel_name, nullptr);
if (ret) {
goto end;
}
goto end;
}
- ret = lttng_add_context(handle, &context, NULL, channel_name);
+ ret = lttng_add_context(handle, &context, nullptr, channel_name);
if (context.ctx == LTTNG_EVENT_CONTEXT_APP_CONTEXT) {
free(context.u.app_ctx.provider_name);
free(context.u.app_ctx.ctx_name);
*element_value_type = config_element_process_attr_pid_value;
*element_value = config_element_process_attr_id;
*element_value_alias = config_element_process_attr_id;
- *element_name = NULL;
+ *element_name = nullptr;
break;
case LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID:
*element_id_tracker = config_element_process_attr_tracker_vpid;
*element_value_type = config_element_process_attr_vpid_value;
*element_value = config_element_process_attr_id;
- *element_value_alias = NULL;
- *element_name = NULL;
+ *element_value_alias = nullptr;
+ *element_name = nullptr;
break;
case LTTNG_PROCESS_ATTR_USER_ID:
*element_id_tracker = config_element_process_attr_tracker_uid;
*element_value_type = config_element_process_attr_uid_value;
*element_value = config_element_process_attr_id;
- *element_value_alias = NULL;
+ *element_value_alias = nullptr;
*element_name = config_element_name;
break;
case LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID:
*element_id_tracker = config_element_process_attr_tracker_vuid;
*element_value_type = config_element_process_attr_vuid_value;
*element_value = config_element_process_attr_id;
- *element_value_alias = NULL;
+ *element_value_alias = nullptr;
*element_name = config_element_name;
break;
case LTTNG_PROCESS_ATTR_GROUP_ID:
*element_id_tracker = config_element_process_attr_tracker_gid;
*element_value_type = config_element_process_attr_gid_value;
*element_value = config_element_process_attr_id;
- *element_value_alias = NULL;
+ *element_value_alias = nullptr;
*element_name = config_element_name;
break;
case LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID:
*element_id_tracker = config_element_process_attr_tracker_vgid;
*element_value_type = config_element_process_attr_vgid_value;
*element_value = config_element_process_attr_id;
- *element_value_alias = NULL;
+ *element_value_alias = nullptr;
*element_name = config_element_name;
break;
default:
static int process_legacy_pid_tracker_node(xmlNodePtr trackers_node, struct lttng_handle *handle)
{
int ret = 0, child_count;
- xmlNodePtr targets_node = NULL;
+ xmlNodePtr targets_node = nullptr;
xmlNodePtr node;
const char *element_id_tracker;
const char *element_target_id;
const char *element_id_alias;
const char *element_name;
enum lttng_error_code tracker_handle_ret_code;
- struct lttng_process_attr_tracker_handle *tracker_handle = NULL;
+ struct lttng_process_attr_tracker_handle *tracker_handle = nullptr;
enum lttng_process_attr_tracker_handle_status status;
const enum lttng_process_attr process_attr = handle->domain.type == LTTNG_DOMAIN_UST ?
LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID :
enum lttng_process_attr process_attr)
{
int ret = 0, child_count;
- xmlNodePtr values_node = NULL;
+ xmlNodePtr values_node = nullptr;
xmlNodePtr node;
const char *element_id_tracker;
const char *element_target_id;
const char *element_id_alias;
const char *element_name;
enum lttng_error_code tracker_handle_ret_code;
- struct lttng_process_attr_tracker_handle *tracker_handle = NULL;
+ struct lttng_process_attr_tracker_handle *tracker_handle = nullptr;
enum lttng_process_attr_tracker_handle_status status;
LTTNG_ASSERT(handle);
{
int ret;
struct lttng_domain domain {};
- struct lttng_handle *handle = NULL;
- struct lttng_channel *channel = NULL;
- xmlNodePtr channels_node = NULL;
- xmlNodePtr trackers_node = NULL;
- xmlNodePtr pid_tracker_node = NULL;
- xmlNodePtr vpid_tracker_node = NULL;
- xmlNodePtr uid_tracker_node = NULL;
- xmlNodePtr vuid_tracker_node = NULL;
- xmlNodePtr gid_tracker_node = NULL;
- xmlNodePtr vgid_tracker_node = NULL;
+ struct lttng_handle *handle = nullptr;
+ struct lttng_channel *channel = nullptr;
+ xmlNodePtr channels_node = nullptr;
+ xmlNodePtr trackers_node = nullptr;
+ xmlNodePtr pid_tracker_node = nullptr;
+ xmlNodePtr vpid_tracker_node = nullptr;
+ xmlNodePtr uid_tracker_node = nullptr;
+ xmlNodePtr vuid_tracker_node = nullptr;
+ xmlNodePtr gid_tracker_node = nullptr;
+ xmlNodePtr vgid_tracker_node = nullptr;
xmlNodePtr node;
LTTNG_ASSERT(session_name);
/* create all channels */
for (node = xmlFirstElementChild(channels_node); node; node = xmlNextElementSibling(node)) {
const enum lttng_domain_type original_domain = domain.type;
- xmlNodePtr contexts_node = NULL;
- xmlNodePtr events_node = NULL;
+ xmlNodePtr contexts_node = nullptr;
+ xmlNodePtr events_node = nullptr;
xmlNodePtr channel_attr_node;
/*
lttng_channel_destroy(channel);
}
- channel = NULL;
+ channel = nullptr;
/* get the trackers node */
for (node = xmlFirstElementChild(domain_node); node; node = xmlNextElementSibling(node)) {
time_us_node = xmlFirstElementChild(child);
if (!time_us_node ||
strcmp((const char *) time_us_node->name,
- config_element_rotation_schedule_periodic_time_us)) {
+ config_element_rotation_schedule_periodic_time_us) != 0) {
ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
goto end;
}
bytes_node = xmlFirstElementChild(child);
if (!bytes_node ||
strcmp((const char *) bytes_node->name,
- config_element_rotation_schedule_size_threshold_bytes)) {
+ config_element_rotation_schedule_size_threshold_bytes) != 0) {
ret = -LTTNG_ERR_LOAD_INVALID_CONFIG;
goto end;
}
{
int ret, started = -1, snapshot_mode = -1;
uint64_t live_timer_interval = UINT64_MAX, rotation_timer_interval = 0, rotation_size = 0;
- xmlChar *name = NULL;
- xmlChar *shm_path = NULL;
- xmlNodePtr domains_node = NULL;
- xmlNodePtr output_node = NULL;
+ xmlChar *name = nullptr;
+ xmlChar *shm_path = nullptr;
+ xmlNodePtr domains_node = nullptr;
+ xmlNodePtr output_node = nullptr;
xmlNodePtr node;
xmlNodePtr attributes_child;
- struct lttng_domain *kernel_domain = NULL;
- struct lttng_domain *ust_domain = NULL;
- struct lttng_domain *jul_domain = NULL;
- struct lttng_domain *log4j_domain = NULL;
- struct lttng_domain *python_domain = NULL;
+ struct lttng_domain *kernel_domain = nullptr;
+ struct lttng_domain *ust_domain = nullptr;
+ struct lttng_domain *jul_domain = nullptr;
+ struct lttng_domain *log4j_domain = nullptr;
+ struct lttng_domain *python_domain = nullptr;
for (node = xmlFirstElementChild(session_node); node; node = xmlNextElementSibling(node)) {
if (!name && !strcmp((const char *) node->name, config_element_name)) {
goto error;
}
- if (session_name && strcmp((char *) name, session_name)) {
+ if (session_name && strcmp((char *) name, session_name) != 0) {
/* This is not the session we are looking for */
ret = -LTTNG_ERR_NO_SESSION;
goto error;
const struct config_load_session_override_attr *overrides)
{
int ret, session_found = !session_name;
- xmlDocPtr doc = NULL;
+ xmlDocPtr doc = nullptr;
xmlNodePtr sessions_node;
xmlNodePtr session_node;
const struct config_load_session_override_attr *overrides)
{
int ret, session_found = !session_name;
- DIR *directory = NULL;
+ DIR *directory = nullptr;
struct lttng_dynamic_buffer file_path;
size_t path_len;
/* Does the file end with .lttng? */
if (strcmp(DEFAULT_SESSION_CONFIG_FILE_EXTENSION,
result->d_name + file_name_len -
- sizeof(DEFAULT_SESSION_CONFIG_FILE_EXTENSION) + 1)) {
+ sizeof(DEFAULT_SESSION_CONFIG_FILE_EXTENSION) + 1) !=
+ 0) {
continue;
}
{
int ret;
bool session_loaded = false;
- const char *path_ptr = NULL;
+ const char *path_ptr = nullptr;
struct session_config_validation_ctx validation_ctx = {};
ret = init_session_config_validation_ctx(&validation_ctx);
}
/* Reset path pointer for the system wide dir. */
- path_ptr = NULL;
+ path_ptr = nullptr;
/* Try system wide configuration directory. */
if (autoload) {
return ret;
}
-static void __attribute__((destructor)) session_config_exit(void)
+static void __attribute__((destructor)) session_config_exit()
{
xmlCleanupParser();
}