[gobject-introspection] Assert input values in Everything funcs
- From: Tomeu Vizoso <tomeuv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] Assert input values in Everything funcs
- Date: Fri, 9 Apr 2010 14:21:19 +0000 (UTC)
commit c6416126de8ff7a522c873786f92d876a0e41ac2
Author: Tomeu Vizoso <tomeu sugarlabs org>
Date: Fri Apr 9 16:10:34 2010 +0200
Assert input values in Everything funcs
gir/everything.c | 25 +++++++++++++++++++++++++
gir/everything.h | 4 ++++
2 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/gir/everything.c b/gir/everything.c
index 3957d06..7d10dbc 100644
--- a/gir/everything.c
+++ b/gir/everything.c
@@ -3,12 +3,37 @@
#include "everything.h"
#include <gio/gio.h>
+static gboolean abort_on_error = TRUE;
+
+#define ASSERT_VALUE(condition) \
+ if (abort_on_error) \
+ g_assert (condition); \
+ else \
+ g_warn_if_fail (condition); \
+
+void set_abort_on_error (gboolean in)
+{
+ abort_on_error = in;
+}
+
/* basic types */
gboolean test_boolean (gboolean in)
{
return in;
}
+gboolean test_boolean_true (gboolean in)
+{
+ ASSERT_VALUE (in == TRUE);
+ return in;
+}
+
+gboolean test_boolean_false (gboolean in)
+{
+ ASSERT_VALUE (in == FALSE);
+ return in;
+}
+
gint8 test_int8 (gint8 in)
{
return in;
diff --git a/gir/everything.h b/gir/everything.h
index 04c27d7..f317a9d 100644
--- a/gir/everything.h
+++ b/gir/everything.h
@@ -4,8 +4,12 @@
#include <glib-object.h>
#include <time.h>
+void set_abort_on_error (gboolean abort_on_error);
+
/* basic types */
gboolean test_boolean (gboolean in);
+gboolean test_boolean_true (gboolean in);
+gboolean test_boolean_false (gboolean in);
gint8 test_int8 (gint8 in);
guint8 test_uint8 (guint8 in);
gint16 test_int16 (gint16 in);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]