X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=exception.c;h=8f15ff22a520550a519dfb343d30ad8b2826933e;hb=8aeedf9ee376f1b48fe9c42924ebf34f9c8c2ddd;hp=1ce66a875db44b23f4024545defe5bf8f08ac054;hpb=c1f86f02a149f46609273e1bd5b42696d544727a;p=libsigrokdecode.git
diff --git a/exception.c b/exception.c
index 1ce66a8..8f15ff2 100644
--- a/exception.c
+++ b/exception.c
@@ -17,8 +17,8 @@
* along with this program. If not, see .
*/
-#include "libsigrokdecode.h" /* First, so we avoid a _POSIX_C_SOURCE warning. */
-#include "libsigrokdecode-internal.h"
+#include "libsigrokdecode-internal.h" /* First, so we avoid a _POSIX_C_SOURCE warning. */
+#include "libsigrokdecode.h"
#include "config.h"
#include
#include
@@ -46,21 +46,20 @@ SRD_PRIV void srd_exception_catch(const char *format, ...)
return;
}
- msg = g_string_sized_new(128);
- va_start(args, format);
- g_string_vprintf(msg, format, args);
- va_end(args);
-
- /* Can be NULL. */
+ /* Send the exception error message(s) to srd_err(). */
if (evalue)
ename = (char *)Py_TYPE(evalue)->tp_name;
else
+ /* Can be NULL. */
ename = "(unknown exception)";
- /* Send the exception error message(s) to srd_err(). */
- py_str_as_str(py_str, &str);
+ msg = g_string_sized_new(128);
g_string_append(msg, ename);
g_string_append(msg, ": ");
+ va_start(args, format);
+ g_string_append_vprintf(msg, format, args);
+ va_end(args);
+ py_str_as_str(py_str, &str);
g_string_append(msg, str);
Py_DecRef(py_str);
srd_err(msg->str);