Standardize `!ptr` i/o `ptr == NULL`, `ptr` i/o `ptr != NULL`
[babeltrace.git] / src / lib / plugin / plugin-so.c
index 92f47825e72ed1bc6f556b60c86f955905f1f0f6..b9ef8005770c5ca92e060fed50dd045fcf877724 100644 (file)
@@ -125,7 +125,7 @@ void bt_plugin_so_shared_lib_handle_destroy(struct bt_object *obj)
        }
 
        if (shared_lib_handle->module) {
-#ifndef BT_DEBUG_MODE
+#ifdef BT_DEBUG_MODE
                /*
                 * Valgrind shows incomplete stack traces when
                 * dynamically loaded libraries are closed before it
@@ -149,7 +149,7 @@ void bt_plugin_so_shared_lib_handle_destroy(struct bt_object *obj)
                        }
 
                        shared_lib_handle->module = NULL;
-#ifndef BT_DEBUG_MODE
+#ifdef BT_DEBUG_MODE
                } else {
                        BT_LOGI("Not closing GModule because `LIBBABELTRACE2_NO_DLCLOSE=1`: "
                                "path=\"%s\"", path);
@@ -364,7 +364,7 @@ int bt_plugin_so_init(struct bt_plugin *plugin,
                const struct __bt_plugin_descriptor_attribute *cur_attr =
                        *cur_attr_ptr;
 
-               if (cur_attr == NULL) {
+               if (!cur_attr) {
                        continue;
                }
 
@@ -409,7 +409,7 @@ int bt_plugin_so_init(struct bt_plugin *plugin,
                                status = BT_FUNC_STATUS_LOADING_ERROR;
                                goto end;
                        } else {
-                               BT_LIB_LOGI(
+                               BT_LIB_LOGW(
                                        "Ignoring unknown plugin descriptor attribute: "
                                        "plugin-path=\"%s\", plugin-name=\"%s\", "
                                        "attr-type-name=\"%s\", attr-type-id=%d",
@@ -434,7 +434,7 @@ int bt_plugin_so_init(struct bt_plugin *plugin,
                        *cur_cc_descr_ptr;
                struct comp_class_full_descriptor full_descriptor = {0};
 
-               if (cur_cc_descr == NULL) {
+               if (!cur_cc_descr) {
                        continue;
                }
 
@@ -457,7 +457,7 @@ int bt_plugin_so_init(struct bt_plugin *plugin,
                        *cur_cc_descr_attr_ptr;
                enum bt_component_class_type cc_type;
 
-               if (cur_cc_descr_attr == NULL) {
+               if (!cur_cc_descr_attr) {
                        continue;
                }
 
@@ -686,7 +686,7 @@ int bt_plugin_so_init(struct bt_plugin *plugin,
                                        status = BT_FUNC_STATUS_LOADING_ERROR;
                                        goto end;
                                } else {
-                                       BT_LIB_LOGI(
+                                       BT_LIB_LOGW(
                                                "Ignoring unknown component class descriptor attribute: "
                                                "plugin-path=\"%s\", "
                                                "plugin-name=\"%s\", "
@@ -728,7 +728,7 @@ int bt_plugin_so_init(struct bt_plugin *plugin,
                                status = init_status;
                                goto end;
                        } else {
-                               BT_LIB_LOGI(
+                               BT_LIB_LOGW(
                                        "User's plugin initialization function failed: "
                                        "status=%s",
                                        bt_common_func_status_string(init_status));
@@ -799,7 +799,7 @@ int bt_plugin_so_init(struct bt_plugin *plugin,
                                status = BT_FUNC_STATUS_LOADING_ERROR;
                                goto end;
                        } else {
-                               BT_LIB_LOGI(
+                               BT_LIB_LOGW(
                                        "Ignoring unknown component class type: "
                                        "plugin-path=\"%s\", plugin-name=\"%s\", "
                                        "comp-class-name=\"%s\", comp-class-type=%d",
@@ -1319,7 +1319,7 @@ int bt_plugin_so_create_all_from_sections(
                        descriptors_begin[i];
                struct bt_plugin *plugin;
 
-               if (descriptor == NULL) {
+               if (!descriptor) {
                        continue;
                }
 
@@ -1335,7 +1335,7 @@ int bt_plugin_so_create_all_from_sections(
                                status = BT_FUNC_STATUS_LOADING_ERROR;
                                goto error;
                        } else {
-                               BT_LIB_LOGI(
+                               BT_LIB_LOGW(
                                        "Unknown ABI major version: abi-major=%d",
                                                descriptor->major);
                                continue;
@@ -1489,8 +1489,6 @@ int bt_plugin_so_create_all_from_file(const char *path,
        if (status != BT_FUNC_STATUS_OK) {
                /* bt_plugin_so_shared_lib_handle_create() logs more details */
                BT_ASSERT(!shared_lib_handle);
-               BT_LIB_LOGE_APPEND_CAUSE(
-                       "Cannot create shared library handle.");
                goto end;
        }
 
@@ -1526,7 +1524,7 @@ int bt_plugin_so_create_all_from_file(const char *path,
                                "__bt_get_end_section_plugin_descriptors");
                        status = BT_FUNC_STATUS_LOADING_ERROR;
                } else {
-                       BT_LIB_LOGI(
+                       BT_LIB_LOGW(
                                "Cannot resolve plugin symbol: path=\"%s\", "
                                "symbol=\"%s\"", path,
                                "__bt_get_end_section_plugin_descriptors");
@@ -1566,7 +1564,7 @@ int bt_plugin_so_create_all_from_file(const char *path,
                                attrs_begin, attrs_end);
                        status = BT_FUNC_STATUS_LOADING_ERROR;
                } else {
-                       BT_LIB_LOGI(
+                       BT_LIB_LOGW(
                                "Found section start or end symbol, but not both: "
                                "path=\"%s\", symbol-start=\"%s\", "
                                "symbol-end=\"%s\", symbol-start-addr=%p, "
@@ -1610,7 +1608,7 @@ int bt_plugin_so_create_all_from_file(const char *path,
                                cc_descriptors_begin, cc_descriptors_end);
                        status = BT_FUNC_STATUS_LOADING_ERROR;
                } else {
-                       BT_LIB_LOGI(
+                       BT_LIB_LOGW(
                                "Found section start or end symbol, but not both: "
                                "path=\"%s\", symbol-start=\"%s\", "
                                "symbol-end=\"%s\", symbol-start-addr=%p, "
@@ -1654,7 +1652,7 @@ int bt_plugin_so_create_all_from_file(const char *path,
                                cc_descr_attrs_begin, cc_descr_attrs_end);
                        status = BT_FUNC_STATUS_LOADING_ERROR;
                } else {
-                       BT_LIB_LOGI(
+                       BT_LIB_LOGW(
                                "Found section start or end symbol, but not both: "
                                "path=\"%s\", symbol-start=\"%s\", "
                                "symbol-end=\"%s\", symbol-start-addr=%p, "
This page took 0.039135 seconds and 4 git commands to generate.