[telepathy-glib/master] Convert assertions about sizeof to be checked at compile time
Simon McVittie
simon.mcvittie at collabora.co.uk
Fri Jul 31 05:43:21 PDT 2009
---
telepathy-glib/contact.c | 3 ++-
telepathy-glib/errors.c | 4 +++-
tests/dbus/connection-error.c | 3 ++-
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/telepathy-glib/contact.c b/telepathy-glib/contact.c
index 82ee36e..c9a0cac 100644
--- a/telepathy-glib/contact.c
+++ b/telepathy-glib/contact.c
@@ -729,7 +729,8 @@ contacts_context_new (TpConnection *connection,
* cares about platforms where this fails, fixing this would involve
* slice-allocating sizeof (GCallback) bytes repeatedly, and putting *those*
* in the queue. */
- g_assert (sizeof (GCallback) == sizeof (gpointer));
+ tp_verify_statement (sizeof (GCallback) == sizeof (gpointer));
+
g_queue_init (&c->todo);
return c;
diff --git a/telepathy-glib/errors.c b/telepathy-glib/errors.c
index c723c78..edc592d 100644
--- a/telepathy-glib/errors.c
+++ b/telepathy-glib/errors.c
@@ -23,6 +23,8 @@
#include <glib.h>
#include <dbus/dbus-glib.h>
+#include <telepathy-glib/util.h>
+
/**
* TP_ERROR_PREFIX:
*
@@ -207,7 +209,7 @@ tp_errors_quark (void)
{
GQuark domain = g_quark_from_static_string ("tp_errors");
- g_assert (sizeof (GQuark) <= sizeof (gsize));
+ tp_verify_statement (sizeof (GQuark) <= sizeof (gsize));
g_type_init ();
dbus_g_error_domain_register (domain, TP_ERROR_PREFIX,
diff --git a/tests/dbus/connection-error.c b/tests/dbus/connection-error.c
index fee6681..0baf010 100644
--- a/tests/dbus/connection-error.c
+++ b/tests/dbus/connection-error.c
@@ -13,6 +13,7 @@
#include <telepathy-glib/debug.h>
#include <telepathy-glib/interfaces.h>
#include <telepathy-glib/proxy-subclass.h>
+#include <telepathy-glib/util.h>
#include "tests/lib/myassert.h"
#include "tests/lib/simple-conn.h"
@@ -63,7 +64,7 @@ example_com_error_get_type (void)
};
GType gtype;
- g_assert (sizeof (GType) <= sizeof (gsize));
+ tp_verify_statement (sizeof (GType) <= sizeof (gsize));
gtype = g_enum_register_static ("ExampleError", values);
g_once_init_leave (&type, gtype);
--
1.5.6.5
More information about the telepathy-commits
mailing list