lib: make public reference count functions have strict types
[babeltrace.git] / python-plugin-provider / python-plugin-provider.c
index de677c852314a0af206f2b43808a848646d770f1..1eb1fa34182d95c539b06797c7e8da39c7f1e053 100644 (file)
@@ -29,8 +29,7 @@
 
 #include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/compiler-internal.h>
-#include <babeltrace/ref.h>
-#include <babeltrace/plugin/plugin.h>
+#include <babeltrace/plugin/plugin-const.h>
 #include <babeltrace/plugin/plugin-internal.h>
 #include <babeltrace/graph/component-class.h>
 #include <babeltrace/graph/component-class-internal.h>
@@ -158,9 +157,9 @@ void fini_python(void) {
 }
 
 static
-struct bt_plugin *bt_plugin_from_python_plugin_info(PyObject *plugin_info)
+const struct bt_plugin *bt_plugin_from_python_plugin_info(PyObject *plugin_info)
 {
-       struct bt_plugin *plugin = NULL;
+       const struct bt_plugin *plugin = NULL;
        PyObject *py_name = NULL;
        PyObject *py_author = NULL;
        PyObject *py_description = NULL;
@@ -375,7 +374,7 @@ struct bt_plugin *bt_plugin_from_python_plugin_info(PyObject *plugin_info)
 error:
        print_python_traceback_warn();
        pyerr_clear();
-       BT_PUT(plugin);
+       BT_OBJECT_PUT_REF_AND_RESET(plugin);
 
 end:
        Py_XDECREF(py_name);
@@ -391,7 +390,7 @@ G_MODULE_EXPORT
 struct bt_plugin_set *bt_plugin_python_create_all_from_file(const char *path)
 {
        struct bt_plugin_set *plugin_set = NULL;
-       struct bt_plugin *plugin = NULL;
+       const struct bt_plugin *plugin = NULL;
        PyObject *py_plugin_info = NULL;
        gchar *basename = NULL;
        size_t path_len;
@@ -492,10 +491,10 @@ struct bt_plugin_set *bt_plugin_python_create_all_from_file(const char *path)
        goto end;
 
 error:
-       BT_PUT(plugin_set);
+       BT_OBJECT_PUT_REF_AND_RESET(plugin_set);
 
 end:
-       bt_put(plugin);
+       bt_plugin_put_ref(plugin);
        Py_XDECREF(py_plugin_info);
        g_free(basename);
        return plugin_set;
This page took 0.02454 seconds and 4 git commands to generate.