*/
#define BT_LOG_TAG "PLUGIN-PY"
-#include "logging.h"
#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>
}
static
-struct bt_plugin *bt_plugin_from_python_plugin_info(PyObject *plugin_info)
+bt_plugin *bt_plugin_from_python_plugin_info(PyObject *plugin_info)
{
- struct bt_plugin *plugin = NULL;
+ bt_plugin *plugin = NULL;
PyObject *py_name = NULL;
PyObject *py_author = NULL;
PyObject *py_description = NULL;
size_t i;
for (i = 0; i < PyList_Size(py_comp_class_addrs); i++) {
- struct bt_component_class *comp_class;
+ bt_component_class *comp_class;
PyObject *py_comp_class_addr;
py_comp_class_addr =
PyList_GetItem(py_comp_class_addrs, i);
BT_ASSERT(py_comp_class_addr);
if (PyLong_Check(py_comp_class_addr)) {
- comp_class = (struct bt_component_class *)
- PyLong_AsUnsignedLongLong(py_comp_class_addr);
+ comp_class = PyLong_AsVoidPtr(py_comp_class_addr);
} else {
BT_LOGW("Component class address is not an integer in Python plugin info object: "
"py-plugin-info-addr=%p, index=%zu",
}
}
- bt_plugin_freeze(plugin);
-
goto end;
error:
print_python_traceback_warn();
pyerr_clear();
- BT_PUT(plugin);
+ BT_OBJECT_PUT_REF_AND_RESET(plugin);
end:
Py_XDECREF(py_name);
}
G_MODULE_EXPORT
-struct bt_plugin_set *bt_plugin_python_create_all_from_file(const char *path)
+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;
+ bt_plugin_set *plugin_set = NULL;
+ bt_plugin *plugin = NULL;
PyObject *py_plugin_info = NULL;
gchar *basename = NULL;
size_t path_len;
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;