tests: remove problematic (and unnecessary) type annotation
[babeltrace.git] / src / bindings / python / bt2 / bt2 / native_bt_plugin.i.h
1 /*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
5 */
6
7 #ifndef BABELTRACE_BINDINGS_PYTHON_BT2_BT2_NATIVE_BT_PLUGIN_I_H
8 #define BABELTRACE_BINDINGS_PYTHON_BT2_BT2_NATIVE_BT_PLUGIN_I_H
9
10 /*
11 * Those bt_bt2_*() functions below ensure that when the API function
12 * fails, the output parameter is set to `NULL`. This is necessary
13 * because the epilogue of the `something **OUT` typemap will use that
14 * value to make a Python object. We can't rely on the initial value of
15 * `*OUT`; it could point to unreadable memory.
16 */
17
18 static
19 bt_property_availability bt_bt2_plugin_get_version(
20 const bt_plugin *plugin, unsigned int *major,
21 unsigned int *minor, unsigned int *patch, const char **extra)
22 {
23 bt_property_availability ret;
24
25 ret = bt_plugin_get_version(plugin, major, minor, patch, extra);
26
27 if (ret == BT_PROPERTY_AVAILABILITY_NOT_AVAILABLE) {
28 *extra = NULL;
29 }
30
31 return ret;
32 }
33
34 static
35 bt_plugin_find_status bt_bt2_plugin_find(const char *plugin_name,
36 bt_bool find_in_std_env_var, bt_bool find_in_user_dir,
37 bt_bool find_in_sys_dir, bt_bool find_in_static,
38 bt_bool fail_on_load_error, const bt_plugin **plugin)
39 {
40 bt_plugin_find_status status;
41
42 status = bt_plugin_find(plugin_name, find_in_std_env_var,
43 find_in_user_dir, find_in_sys_dir, find_in_static,
44 fail_on_load_error, plugin);
45 if (status != __BT_FUNC_STATUS_OK) {
46 *plugin = NULL;
47 }
48
49 return status;
50 }
51
52 static
53 bt_plugin_find_all_status bt_bt2_plugin_find_all(bt_bool find_in_std_env_var,
54 bt_bool find_in_user_dir, bt_bool find_in_sys_dir,
55 bt_bool find_in_static, bt_bool fail_on_load_error,
56 const bt_plugin_set **plugin_set)
57 {
58 bt_plugin_find_all_status status;
59
60 status = bt_plugin_find_all(find_in_std_env_var,
61 find_in_user_dir, find_in_sys_dir, find_in_static,
62 fail_on_load_error, plugin_set);
63 if (status != __BT_FUNC_STATUS_OK) {
64 *plugin_set = NULL;
65 }
66
67 return status;
68 }
69
70 static
71 bt_plugin_find_all_from_file_status bt_bt2_plugin_find_all_from_file(
72 const char *path, bt_bool fail_on_load_error,
73 const bt_plugin_set **plugin_set)
74 {
75 bt_plugin_find_all_from_file_status status;
76
77 status = bt_plugin_find_all_from_file(path, fail_on_load_error,
78 plugin_set);
79 if (status != __BT_FUNC_STATUS_OK) {
80 *plugin_set = NULL;
81 }
82
83 return status;
84 }
85
86 static
87 bt_plugin_find_all_from_dir_status bt_bt2_plugin_find_all_from_dir(
88 const char *path, bt_bool recurse, bt_bool fail_on_load_error,
89 const bt_plugin_set **plugin_set)
90 {
91 bt_plugin_find_all_from_dir_status status;
92
93 status = bt_plugin_find_all_from_dir(path, recurse, fail_on_load_error,
94 plugin_set);
95 if (status != __BT_FUNC_STATUS_OK) {
96 *plugin_set = NULL;
97 }
98
99 return status;
100 }
101
102 #endif /* BABELTRACE_BINDINGS_PYTHON_BT2_BT2_NATIVE_BT_PLUGIN_I_H */
This page took 0.032366 seconds and 5 git commands to generate.