bt2: Add wrapper for bt_plugin_get_version
[babeltrace.git] / bindings / python / bt2 / bt2 / native_bt.i
index b1e2d27df70382341801768cd98dc0ab918401d8..fe289b0bd0139d63f729589551538265b980008a 100644 (file)
@@ -52,8 +52,16 @@ typedef int bt_bool;
 %rename("%(strip:[bt_])s", %$isvariable) "";
 %rename("%(strip:[BT_])s", %$isenumitem) "";
 
-/* Output argument typemap for string output (always appends) */
-%typemap(in, numinputs=0) (const char **OUT) (char *temp_value) {
+/*
+ * Output argument typemap for string output (always appends)
+ *
+ * We initialize the output parameter `temp_value` to an invalid but non-zero
+ * pointer value.  This is to make sure we don't rely on its initial value in
+ * the epilogue (where we call SWIG_Python_str_FromChar).  When they fail,
+ * functions on which we apply this typemap don't guarantee that the value of
+ * `temp_value` will be unchanged or valid.
+ */
+%typemap(in, numinputs=0) (const char **OUT) (char *temp_value = (void *) 1) {
        $1 = &temp_value;
 }
 
This page took 0.023956 seconds and 4 git commands to generate.