[beast: 9/22] SFI: use Rapicorn's assert_return()
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast: 9/22] SFI: use Rapicorn's assert_return()
- Date: Thu, 24 Sep 2015 20:09:43 +0000 (UTC)
commit dbea1c75af2391548d7a414cc8d63b830f5a7d5d
Author: Tim Janik <timj gnu org>
Date: Mon Sep 21 19:47:37 2015 +0200
SFI: use Rapicorn's assert_return()
sfi/gbsearcharray.hh | 10 ++--
sfi/glib-extra.cc | 54 +++++++++---------
sfi/glib-extra.hh | 2 +-
sfi/sficomport.cc | 56 ++++++++++----------
sfi/sficomwire.cc | 84 +++++++++++++++---------------
sfi/sficxx.hh | 10 ++--
sfi/sfidl-cbase.cc | 14 +++---
sfi/sfidl-clientcxx.cc | 2 +-
sfi/sfidl-corec.cc | 4 +-
sfi/sfidl-options.cc | 8 ++--
sfi/sfidl-parser.cc | 6 +-
sfi/sfidl-utils.cc | 2 +-
sfi/sfifilecrawler.cc | 20 ++++----
sfi/sfiglue.cc | 100 +++++++++++++++++-----------------
sfi/sfigluecodec.cc | 18 +++---
sfi/sfiglueproxy.cc | 84 +++++++++++++++---------------
sfi/sfimemory.cc | 8 ++--
sfi/sfinote.cc | 4 +-
sfi/sfiparams.cc | 106 ++++++++++++++++++------------------
sfi/sfiprimitives.cc | 138 ++++++++++++++++++++++++------------------------
sfi/sfiring.cc | 20 ++++----
sfi/sfiserial.cc | 28 +++++-----
sfi/sfistore.cc | 92 ++++++++++++++++----------------
sfi/sfitime.cc | 2 +-
sfi/sfitypes.cc | 10 ++--
sfi/sfiustore.cc | 22 ++++----
sfi/sfivalues.cc | 78 ++++++++++++++--------------
sfi/sfivmarshal.cc | 2 +-
28 files changed, 492 insertions(+), 492 deletions(-)
---
diff --git a/sfi/gbsearcharray.hh b/sfi/gbsearcharray.hh
index d33a713..5912f86 100644
--- a/sfi/gbsearcharray.hh
+++ b/sfi/gbsearcharray.hh
@@ -114,7 +114,7 @@ g_bsearch_array_create (const GBSearchConfig *bconfig)
GBSearchArray *barray;
guint size;
- g_return_val_if_fail (bconfig != NULL, NULL);
+ assert_return (bconfig != NULL, NULL);
size = sizeof (GBSearchArray) + bconfig->sizeof_node;
if (bconfig->flags & G_BSEARCH_ARRAY_ALIGN_POWER2)
@@ -172,7 +172,7 @@ g_bsearch_array_get_index (GBSearchArray *barray,
{
guint distance = ((guint8*) node_in_array) - G_BSEARCH_ARRAY_NODES (barray);
- g_return_val_if_fail (node_in_array != NULL, barray->n_nodes);
+ assert_return (node_in_array != NULL, barray->n_nodes);
distance /= bconfig->sizeof_node;
@@ -187,7 +187,7 @@ g_bsearch_array_grow (GBSearchArray *barray,
guint new_size = old_size + bconfig->sizeof_node;
guint8 *node;
- g_return_val_if_fail (index <= barray->n_nodes, NULL);
+ assert_return (index <= barray->n_nodes, NULL);
if (G_UNLIKELY (bconfig->flags & G_BSEARCH_ARRAY_ALIGN_POWER2))
{
@@ -251,7 +251,7 @@ g_bsearch_array_remove (GBSearchArray *barray,
{
guint8 *node;
- g_return_val_if_fail (index < barray->n_nodes, NULL);
+ assert_return (index < barray->n_nodes, NULL);
barray->n_nodes -= 1;
node = G_BSEARCH_ARRAY_NODES (barray) + index * bconfig->sizeof_node;
@@ -284,7 +284,7 @@ static inline void
g_bsearch_array_free (GBSearchArray *barray,
const GBSearchConfig *bconfig)
{
- g_return_if_fail (barray != NULL);
+ assert_return (barray != NULL);
g_free (barray);
}
diff --git a/sfi/glib-extra.cc b/sfi/glib-extra.cc
index cf4625e..48d596e 100644
--- a/sfi/glib-extra.cc
+++ b/sfi/glib-extra.cc
@@ -8,8 +8,8 @@ g_object_disconnect_any (gpointer object,
gpointer function,
gpointer data)
{
- g_return_if_fail (G_IS_OBJECT (object));
- g_return_if_fail (function != NULL);
+ assert_return (G_IS_OBJECT (object));
+ assert_return (function != NULL);
/* FIXME: the only reason we have this function is that
* g_object_disconnect() throws a warning for an any-signal::
* disconnection that does not exist (it may do so for all-signals
@@ -238,7 +238,7 @@ g_option_find_value (const gchar *option_string,
const gchar *p, *match = NULL;
gint l = strlen (option);
- g_return_val_if_fail (l > 0, NULL);
+ assert_return (l > 0, NULL);
if (!option_string)
return NULL; /* option not found */
@@ -352,7 +352,7 @@ g_param_spec_set_options (GParamSpec *pspec,
{
if (!quark_pspec_options)
quark_pspec_options = g_quark_from_static_string ("GParamSpec-options");
- g_return_if_fail (G_IS_PARAM_SPEC (pspec));
+ assert_return (G_IS_PARAM_SPEC (pspec));
if (options)
g_param_spec_set_qdata (pspec, quark_pspec_options, (gchar*) g_intern_string (options));
/* pspec->flags &= ~G_PARAM_MASK; */
@@ -364,7 +364,7 @@ g_param_spec_check_option (GParamSpec *pspec,
const gchar *option)
{
const gchar *poptions;
- g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE);
+ assert_return (G_IS_PARAM_SPEC (pspec), FALSE);
poptions = g_param_spec_get_options (pspec);
return g_option_check (poptions, option);
}
@@ -376,9 +376,9 @@ g_param_spec_add_option (GParamSpec *pspec,
{
const gchar *options;
guint append = 0;
- g_return_if_fail (G_IS_PARAM_SPEC (pspec));
- g_return_if_fail (option != NULL && !strchr (option, ':'));
- g_return_if_fail (value == NULL || !strcmp (value, "-") || !strcmp (value, "+"));
+ assert_return (G_IS_PARAM_SPEC (pspec));
+ assert_return (option != NULL && !strchr (option, ':'));
+ assert_return (value == NULL || !strcmp (value, "-") || !strcmp (value, "+"));
options = g_param_spec_get_options (pspec);
if (!options)
options = "";
@@ -406,8 +406,8 @@ g_param_spec_provides_options (GParamSpec *pspec,
const gchar *options)
{
const gchar *p;
- g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE);
- g_return_val_if_fail (options != NULL, FALSE);
+ assert_return (G_IS_PARAM_SPEC (pspec), FALSE);
+ assert_return (options != NULL, FALSE);
recurse:
while (options[0] == ':')
options++;
@@ -432,7 +432,7 @@ const gchar*
g_param_spec_get_options (GParamSpec *pspec)
{
const char *options;
- g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), NULL);
+ assert_return (G_IS_PARAM_SPEC (pspec), NULL);
options = (const char*) g_param_spec_get_qdata (pspec, quark_pspec_options);
return options ? options : "";
}
@@ -449,7 +449,7 @@ g_param_spec_set_istepping (GParamSpec *pspec,
quark_pspec_istepping = g_quark_from_static_string ("GParamSpec-istepping");
quark_pspec_istepping64 = g_quark_from_static_string ("GParamSpec-istepping64");
}
- g_return_if_fail (G_IS_PARAM_SPEC (pspec));
+ assert_return (G_IS_PARAM_SPEC (pspec));
if (stepping >> 32)
{
guint64 *istepping64 = g_new (guint64, 1);
@@ -468,7 +468,7 @@ guint64
g_param_spec_get_istepping (GParamSpec *pspec)
{
guint64 stepping;
- g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), 0);
+ assert_return (G_IS_PARAM_SPEC (pspec), 0);
stepping = size_t (g_param_spec_get_qdata (pspec, quark_pspec_istepping));
if (!stepping)
{
@@ -486,7 +486,7 @@ g_param_spec_set_fstepping (GParamSpec *pspec,
{
if (!quark_pspec_fstepping)
quark_pspec_fstepping = g_quark_from_static_string ("GParamSpec-fstepping");
- g_return_if_fail (G_IS_PARAM_SPEC (pspec));
+ assert_return (G_IS_PARAM_SPEC (pspec));
if (stepping)
{
gdouble *fstepping = g_new (gdouble, 1);
@@ -501,7 +501,7 @@ gdouble
g_param_spec_get_fstepping (GParamSpec *pspec)
{
double *fstepping;
- g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), 0);
+ assert_return (G_IS_PARAM_SPEC (pspec), 0);
fstepping = (double*) g_param_spec_get_qdata (pspec, quark_pspec_fstepping);
return fstepping ? *fstepping : 0;
}
@@ -522,7 +522,7 @@ g_param_spec_set_log_scale (GParamSpec *pspec,
{
if (!quark_pspec_log_scale)
quark_pspec_log_scale = g_quark_from_static_string ("GParamSpec-log-scale");
- g_return_if_fail (G_IS_PARAM_SPEC (pspec));
+ assert_return (G_IS_PARAM_SPEC (pspec));
if (n_steps > 0 && base > 0)
{
LogScale *lscale = g_new0 (LogScale, 1);
@@ -543,7 +543,7 @@ g_param_spec_get_log_scale (GParamSpec *pspec,
gdouble *n_steps)
{
LogScale *lscale;
- g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE);
+ assert_return (G_IS_PARAM_SPEC (pspec), FALSE);
lscale = (LogScale*) g_param_spec_get_qdata (pspec, quark_pspec_log_scale);
if (lscale)
{
@@ -565,7 +565,7 @@ g_slist_pop_head (GSList **slist_p)
{
gpointer data;
- g_return_val_if_fail (slist_p != NULL, NULL);
+ assert_return (slist_p != NULL, NULL);
if (!*slist_p)
return NULL;
@@ -593,7 +593,7 @@ g_list_pop_head (GList **list_p)
{
gpointer data;
- g_return_val_if_fail (list_p != NULL, NULL);
+ assert_return (list_p != NULL, NULL);
if (!*list_p)
return NULL;
@@ -738,7 +738,7 @@ type_name_to_cname (const gchar *type_name,
gchar*
g_type_name_to_cname (const gchar *type_name)
{
- g_return_val_if_fail (type_name != NULL, NULL);
+ assert_return (type_name != NULL, NULL);
return type_name_to_cname (type_name, "", '_', FALSE);
}
@@ -746,7 +746,7 @@ g_type_name_to_cname (const gchar *type_name)
gchar*
g_type_name_to_sname (const gchar *type_name)
{
- g_return_val_if_fail (type_name != NULL, NULL);
+ assert_return (type_name != NULL, NULL);
return type_name_to_cname (type_name, "", '-', FALSE);
}
@@ -754,7 +754,7 @@ g_type_name_to_sname (const gchar *type_name)
gchar*
g_type_name_to_cupper (const gchar *type_name)
{
- g_return_val_if_fail (type_name != NULL, NULL);
+ assert_return (type_name != NULL, NULL);
return type_name_to_cname (type_name, "", '_', TRUE);
}
@@ -762,7 +762,7 @@ g_type_name_to_cupper (const gchar *type_name)
gchar*
g_type_name_to_type_macro (const gchar *type_name)
{
- g_return_val_if_fail (type_name != NULL, NULL);
+ assert_return (type_name != NULL, NULL);
return type_name_to_cname (type_name, "_TYPE", '_', TRUE);
}
@@ -841,8 +841,8 @@ g_source_simple (gint priority,
va_list var_args;
GPollFD *pfd;
- g_return_val_if_fail (pending != NULL, NULL);
- g_return_val_if_fail (dispatch != NULL, NULL);
+ assert_return (pending != NULL, NULL);
+ assert_return (dispatch != NULL, NULL);
source = g_source_new (&simple_source_funcs, sizeof (SimpleSource));
g_source_set_priority (source, priority);
@@ -909,7 +909,7 @@ g_predicate_idle_add_full (gint priority,
GDestroyNotify notify)
{
static GSourceFuncs predicate_idle_funcs = { predicate_idle_prepare, predicate_idle_check,
predicate_idle_dispatch, };
- g_return_val_if_fail (predicate && function, 0);
+ assert_return (predicate && function, 0);
GSource *source = g_source_new (&predicate_idle_funcs, sizeof (PredicateIdle));
g_source_set_priority (source, priority);
((PredicateIdle*) source)->predicate = predicate;
@@ -1007,7 +1007,7 @@ g_usignal_add_full (gint priority,
GUSignalData *usignal_data;
guint s = 128 + usignal;
- g_return_val_if_fail (function != NULL, 0);
+ assert_return (function != NULL, 0);
usignal_data = g_new (GUSignalData, 1);
usignal_data->index = s / 32;
diff --git a/sfi/glib-extra.hh b/sfi/glib-extra.hh
index 3bf8383..d29b62b 100644
--- a/sfi/glib-extra.hh
+++ b/sfi/glib-extra.hh
@@ -167,7 +167,7 @@ g_bit_matrix_change (GBitMatrix *matrix,
gboolean bit_set)
{
guint32 cons, index, shift;
- g_return_if_fail (matrix && x < matrix->width && y < matrix->height);
+ assert_return (matrix && x < matrix->width && y < matrix->height);
cons = y * matrix->width + x;
index = cons >> 5; /* / 32 */
shift = cons & 0x1f; /* % 32 */
diff --git a/sfi/sficomport.cc b/sfi/sficomport.cc
index 9fb0d94..b7daa00 100644
--- a/sfi/sficomport.cc
+++ b/sfi/sficomport.cc
@@ -57,7 +57,7 @@ sfi_com_port_from_child (const gchar *ident,
{
SfiComPort *port;
- g_return_val_if_fail (ident != NULL, NULL);
+ assert_return (ident != NULL, NULL);
port = g_new0 (SfiComPort, 1);
port->ref_count = 1;
@@ -98,7 +98,7 @@ sfi_com_port_from_pipe (const gchar *ident,
gint remote_input,
gint remote_output)
{
- g_return_val_if_fail (ident != NULL, NULL);
+ assert_return (ident != NULL, NULL);
return sfi_com_port_from_child (ident,
remote_input,
@@ -111,9 +111,9 @@ sfi_com_port_create_linked (const gchar *ident1, std::function<void()> wakeup1,
const gchar *ident2, std::function<void()> wakeup2, SfiComPort **port2)
{
SfiComPortLink *link;
- g_return_if_fail (wakeup1 && ident1);
- g_return_if_fail (wakeup2 && ident2);
- g_return_if_fail (port1 && port2);
+ assert_return (wakeup1 && ident1);
+ assert_return (wakeup2 && ident2);
+ assert_return (port1 && port2);
link = new SfiComPortLink();
link->port1 = sfi_com_port_from_child (ident1, -1, -1, -1);
link->wakeup1 = wakeup1;
@@ -131,8 +131,8 @@ sfi_com_port_create_linked (const gchar *ident1, std::function<void()> wakeup1,
static void
sfi_com_port_link_destroy (SfiComPortLink *link)
{
- g_return_if_fail (link->ref_count == 0);
- g_return_if_fail (link->port1== NULL && link->port2 == NULL);
+ assert_return (link->ref_count == 0);
+ assert_return (link->port1== NULL && link->port2 == NULL);
while (link->p1queue)
sfi_value_free ((GValue*) sfi_ring_pop_head (&link->p1queue));
@@ -144,8 +144,8 @@ sfi_com_port_link_destroy (SfiComPortLink *link)
SfiComPort*
sfi_com_port_ref (SfiComPort *port)
{
- g_return_val_if_fail (port != NULL, NULL);
- g_return_val_if_fail (port->ref_count > 0, NULL);
+ assert_return (port != NULL, NULL);
+ assert_return (port->ref_count > 0, NULL);
port->ref_count++;
return port;
@@ -156,7 +156,7 @@ sfi_com_port_set_close_func (SfiComPort *port,
SfiComPortClosedFunc func,
gpointer close_data)
{
- g_return_if_fail (port != NULL);
+ assert_return (port != NULL);
port->close_func = func;
port->close_data = func ? close_data : NULL;
@@ -193,7 +193,7 @@ void
sfi_com_port_close_remote (SfiComPort *port,
gboolean terminate_child)
{
- g_return_if_fail (port != NULL);
+ assert_return (port != NULL);
port->connected = FALSE;
if (port->pfd[0].fd >= 0)
@@ -253,7 +253,7 @@ sfi_com_port_close_remote (SfiComPort *port,
static void
sfi_com_port_destroy (SfiComPort *port)
{
- g_return_if_fail (port != NULL);
+ assert_return (port != NULL);
sfi_com_port_close_remote (port, FALSE);
if (port->scanner)
@@ -269,8 +269,8 @@ sfi_com_port_destroy (SfiComPort *port)
void
sfi_com_port_unref (SfiComPort *port)
{
- g_return_if_fail (port != NULL);
- g_return_if_fail (port->ref_count > 0);
+ assert_return (port != NULL);
+ assert_return (port->ref_count > 0);
port->ref_count--;
if (!port->ref_count)
@@ -345,10 +345,10 @@ sfi_com_port_send_bulk (SfiComPort *port,
SfiRing *value_ring)
{
SfiRing *ring;
- g_return_if_fail (port != NULL);
+ assert_return (port != NULL);
if (!value_ring || !port->connected)
return;
- g_return_if_fail (port->link || port->pfd[1].fd >= 0);
+ assert_return (port->link || port->pfd[1].fd >= 0);
if (port->link)
{
@@ -406,8 +406,8 @@ sfi_com_port_send (SfiComPort *port,
const GValue *value)
{
SfiRing *ring;
- g_return_if_fail (port != NULL);
- g_return_if_fail (value != NULL);
+ assert_return (port != NULL);
+ assert_return (value != NULL);
ring = sfi_ring_append (NULL, (GValue*) value);
sfi_com_port_send_bulk (port, ring);
sfi_ring_free (ring);
@@ -603,10 +603,10 @@ sfi_com_port_recv_intern (SfiComPort *port,
GValue*
sfi_com_port_recv (SfiComPort *port)
{
- g_return_val_if_fail (port != NULL, NULL);
+ assert_return (port != NULL, NULL);
if (!port->connected)
return NULL;
- g_return_val_if_fail (port->link || port->pfd[0].fd >= 0, NULL);
+ assert_return (port->link || port->pfd[0].fd >= 0, NULL);
return sfi_com_port_recv_intern (port, FALSE);
}
@@ -614,10 +614,10 @@ sfi_com_port_recv (SfiComPort *port)
GValue*
sfi_com_port_recv_blocking (SfiComPort *port)
{
- g_return_val_if_fail (port != NULL, NULL);
+ assert_return (port != NULL, NULL);
if (!port->connected)
return NULL;
- g_return_val_if_fail (port->link || port->pfd[0].fd >= 0, NULL);
+ assert_return (port->link || port->pfd[0].fd >= 0, NULL);
return sfi_com_port_recv_intern (port, TRUE);
}
@@ -629,8 +629,8 @@ sfi_com_port_get_poll_fds (SfiComPort *port,
GPollFD *pfds = NULL;
guint n = 0;
- g_return_val_if_fail (port != NULL, NULL);
- g_return_val_if_fail (n_pfds != NULL, NULL);
+ assert_return (port != NULL, NULL);
+ assert_return (n_pfds != NULL, NULL);
if (port->pfd[1].fd >= 0)
{
@@ -649,7 +649,7 @@ sfi_com_port_get_poll_fds (SfiComPort *port,
gboolean
sfi_com_port_io_pending (SfiComPort *port)
{
- g_return_val_if_fail (port != NULL, FALSE);
+ assert_return (port != NULL, FALSE);
/* maintain poll fds */
port->pfd[0].events = port->pfd[0].fd >= 0 ? G_IO_IN : 0;
@@ -678,7 +678,7 @@ sfi_com_port_io_pending (SfiComPort *port)
void
sfi_com_port_process_io (SfiComPort *port)
{
- g_return_if_fail (port != NULL);
+ assert_return (port != NULL);
if (!com_port_read_pending (port) ||
!com_port_write_queued (port))
@@ -691,7 +691,7 @@ void
sfi_com_port_reap_child (SfiComPort *port,
gboolean kill_child)
{
- g_return_if_fail (port != NULL);
+ assert_return (port != NULL);
com_port_try_reap (port, !kill_child);
if (kill_child &&
@@ -708,7 +708,7 @@ sfi_com_port_reap_child (SfiComPort *port,
gboolean
sfi_com_port_test_reap_child (SfiComPort *port)
{
- g_return_val_if_fail (port != NULL, FALSE);
+ assert_return (port != NULL, FALSE);
com_port_try_reap (port, FALSE);
return port->reaped;
}
diff --git a/sfi/sficomwire.cc b/sfi/sficomwire.cc
index f0b74ad..414141b 100644
--- a/sfi/sficomwire.cc
+++ b/sfi/sficomwire.cc
@@ -46,7 +46,7 @@ sfi_com_wire_from_child (const gchar *ident,
{
SfiComWire *wire;
- g_return_val_if_fail (ident != NULL, NULL);
+ assert_return (ident != NULL, NULL);
wire = g_new0 (SfiComWire, 1);
if (remote_pid > 1)
@@ -81,7 +81,7 @@ sfi_com_wire_from_pipe (const gchar *ident,
gint remote_input,
gint remote_output)
{
- g_return_val_if_fail (ident != NULL, NULL);
+ assert_return (ident != NULL, NULL);
return sfi_com_wire_from_child (ident,
remote_input,
@@ -156,7 +156,7 @@ wire_send (SfiComWire *wire,
{
guint strl;
- g_return_if_fail (msg->mlength == 0);
+ assert_return (msg->mlength == 0);
strl = strlen (msg->message) + 1; /* include trailing 0 */
msg->mlength = (4 + /* magic */
@@ -379,8 +379,8 @@ sfi_com_wire_send_request (SfiComWire *wire,
SfiComMsg *msg;
guint request;
- g_return_val_if_fail (wire != NULL, 0);
- g_return_val_if_fail (request_msg != NULL, 0);
+ assert_return (wire != NULL, 0);
+ assert_return (request_msg != NULL, 0);
request = wire_alloc_request (wire);
msg = alloc_msg (SFI_COM_MSG_REQUEST);
@@ -401,10 +401,10 @@ sfi_com_wire_receive_result (SfiComWire *wire,
{
GList *out_link, *in_link;
- g_return_val_if_fail (wire != NULL, NULL);
- g_return_val_if_fail (request > 0, NULL);
+ assert_return (wire != NULL, NULL);
+ assert_return (request > 0, NULL);
out_link = wire_find_link (wire->orequests, request);
- g_return_val_if_fail (out_link != NULL, NULL);
+ assert_return (out_link != NULL, NULL);
wire_receive (wire);
wire_update_alive (wire);
@@ -429,10 +429,10 @@ sfi_com_wire_forget_request (SfiComWire *wire,
{
GList *out_link;
- g_return_if_fail (wire != NULL);
- g_return_if_fail (request > 0);
+ assert_return (wire != NULL);
+ assert_return (request > 0);
out_link = wire_find_link (wire->orequests, request);
- g_return_if_fail (out_link != NULL);
+ assert_return (out_link != NULL);
SfiComMsg *omsg = (SfiComMsg*) out_link->data;
wire->orequests = g_list_delete_link (wire->orequests, out_link);
@@ -442,7 +442,7 @@ sfi_com_wire_forget_request (SfiComWire *wire,
guint
sfi_com_wire_peek_first_result (SfiComWire *wire)
{
- g_return_val_if_fail (wire != NULL, 0);
+ assert_return (wire != NULL, 0);
SfiComMsg *msg = (SfiComMsg*) (wire->iresults ? wire->iresults->data : NULL);
return msg ? msg->request : 0;
@@ -452,8 +452,8 @@ const gchar*
sfi_com_wire_receive_request (SfiComWire *wire,
guint *request_p)
{
- g_return_val_if_fail (wire != NULL, NULL);
- g_return_val_if_fail (request_p != NULL, NULL);
+ assert_return (wire != NULL, NULL);
+ assert_return (request_p != NULL, NULL);
wire_receive (wire);
wire_update_alive (wire);
@@ -490,11 +490,11 @@ sfi_com_wire_send_result (SfiComWire *wire,
SfiComMsg *msg;
GList *received_link;
- g_return_if_fail (wire != NULL);
- g_return_if_fail (request > 0);
- g_return_if_fail (result_msg != NULL);
+ assert_return (wire != NULL);
+ assert_return (request > 0);
+ assert_return (result_msg != NULL);
received_link = wire_find_link (wire->rrequests, request);
- g_return_if_fail (received_link != NULL);
+ assert_return (received_link != NULL);
msg = alloc_msg (SFI_COM_MSG_RESULT);
msg->request = request;
@@ -514,10 +514,10 @@ sfi_com_wire_discard_request (SfiComWire *wire,
{
GList *received_link;
- g_return_if_fail (wire != NULL);
- g_return_if_fail (request > 0);
+ assert_return (wire != NULL);
+ assert_return (request > 0);
received_link = wire_find_link (wire->rrequests, request);
- g_return_if_fail (received_link != NULL);
+ assert_return (received_link != NULL);
free_msg ((SfiComMsg*) received_link->data);
wire->rrequests = g_list_delete_link (wire->rrequests, received_link);
@@ -542,7 +542,7 @@ sfi_com_wire_set_dispatcher (SfiComWire *wire,
gpointer dispatch_data,
GDestroyNotify destroy_data)
{
- g_return_if_fail (wire != NULL);
+ assert_return (wire != NULL);
if (wire->destroy_data)
wire->destroy_data (wire->dispatch_data);
@@ -567,10 +567,10 @@ sfi_com_wire_dispatch (SfiComWire *wire,
GList *received_link;
gboolean handled;
- g_return_if_fail (wire != NULL);
- g_return_if_fail (request > 0);
+ assert_return (wire != NULL);
+ assert_return (request > 0);
received_link = wire_find_link (wire->rrequests, request);
- g_return_if_fail (received_link != NULL);
+ assert_return (received_link != NULL);
SfiComMsg *msg = (SfiComMsg*) received_link->data;
handled = wire->dispatch_func (wire->dispatch_data, msg->request, msg->message, wire);
@@ -581,7 +581,7 @@ sfi_com_wire_dispatch (SfiComWire *wire,
gboolean
sfi_com_wire_need_dispatch (SfiComWire *wire)
{
- g_return_val_if_fail (wire != NULL, FALSE);
+ assert_return (wire != NULL, FALSE);
return wire->iresults || wire->irequests || wire->gstring_stdout->len || wire->gstring_stderr->len;
}
@@ -590,8 +590,8 @@ gint*
sfi_com_wire_get_read_fds (SfiComWire *wire,
guint *n_fds_p)
{
- g_return_val_if_fail (wire != NULL, NULL);
- g_return_val_if_fail (n_fds_p != NULL, NULL);
+ assert_return (wire != NULL, NULL);
+ assert_return (n_fds_p != NULL, NULL);
if (wire->remote_input >= 0 ||
wire->standard_output >= 0 ||
@@ -620,8 +620,8 @@ gint*
sfi_com_wire_get_write_fds (SfiComWire *wire,
guint *n_fds_p)
{
- g_return_val_if_fail (wire != NULL, NULL);
- g_return_val_if_fail (n_fds_p != NULL, NULL);
+ assert_return (wire != NULL, NULL);
+ assert_return (n_fds_p != NULL, NULL);
if (wire->obp - wire->obuffer && wire->remote_output >= 0)
{
@@ -643,8 +643,8 @@ GPollFD*
sfi_com_wire_get_poll_fds (SfiComWire *wire,
guint *n_pfds_p)
{
- g_return_val_if_fail (wire != NULL, NULL);
- g_return_val_if_fail (n_pfds_p != NULL, NULL);
+ assert_return (wire != NULL, NULL);
+ assert_return (n_pfds_p != NULL, NULL);
if (wire->remote_input >= 0 ||
wire->standard_output >= 0 ||
@@ -690,7 +690,7 @@ sfi_com_wire_get_poll_fds (SfiComWire *wire,
void
sfi_com_wire_process_io (SfiComWire *wire)
{
- g_return_if_fail (wire != NULL);
+ assert_return (wire != NULL);
wire_capture (wire);
wire_write_remote (wire);
@@ -733,7 +733,7 @@ void
sfi_com_wire_close_remote (SfiComWire *wire,
gboolean terminate)
{
- g_return_if_fail (wire != NULL);
+ assert_return (wire != NULL);
wire->connected = FALSE;
if (wire->remote_input >= 0)
@@ -761,7 +761,7 @@ sfi_com_wire_destroy (SfiComWire *wire)
{
GList *list;
- g_return_if_fail (wire != NULL);
+ assert_return (wire != NULL);
sfi_com_wire_set_dispatcher (wire, NULL, NULL, NULL);
sfi_com_wire_close_remote (wire, TRUE);
@@ -790,7 +790,7 @@ sfi_com_wire_receive_dispatch (SfiComWire *wire)
{
guint request;
- g_return_val_if_fail (wire != NULL, FALSE);
+ assert_return (wire != NULL, FALSE);
if (sfi_com_wire_receive_request (wire, &request))
{
@@ -808,7 +808,7 @@ sfi_com_wire_select (SfiComWire *wire,
uint i, n;
struct timeval tv;
- g_return_if_fail (wire != NULL);
+ assert_return (wire != NULL);
fd_set rfds, wfds, efds;
FD_ZERO (&rfds);
@@ -846,8 +846,8 @@ sfi_com_wire_ping_pong (SfiComWire *wire,
guint request;
gchar *pong;
- g_return_val_if_fail (wire != NULL, NULL);
- g_return_val_if_fail (ping != NULL, NULL);
+ assert_return (wire != NULL, NULL);
+ assert_return (ping != NULL, NULL);
request = sfi_com_wire_send_request (wire, ping);
pong = sfi_com_wire_receive_result (wire, request);
@@ -941,11 +941,11 @@ sfi_com_spawn_async (const gchar *executable,
GError *error = NULL;
uint l;
- g_return_val_if_fail (executable != NULL, NULL);
+ assert_return (executable != NULL, NULL);
if (command_fd_option)
- g_return_val_if_fail (command_fd_option && command_input && command_output, NULL);
+ assert_return (command_fd_option && command_input && command_output, NULL);
else
- g_return_val_if_fail (!command_fd_option && !command_input && !command_output, NULL);
+ assert_return (!command_fd_option && !command_input && !command_output, NULL);
if (command_fd_option)
{
diff --git a/sfi/sficxx.hh b/sfi/sficxx.hh
index a56d789..b40101a 100644
--- a/sfi/sficxx.hh
+++ b/sfi/sficxx.hh
@@ -611,7 +611,7 @@ public:
void
unref ()
{
- g_return_if_fail (block != NULL && block->ref_count > 1);
+ assert_return (block != NULL && block->ref_count > 1);
sfi_fblock_unref (block);
}
void
@@ -752,7 +752,7 @@ public:
void
unref ()
{
- g_return_if_fail (block != NULL && block->ref_count > 1);
+ assert_return (block != NULL && block->ref_count > 1);
sfi_bblock_unref (block);
}
void resize (unsigned int length)
@@ -883,7 +883,7 @@ public:
void
unref ()
{
- g_return_if_fail (crec != NULL && crec->ref_count > 1);
+ assert_return (crec != NULL && crec->ref_count > 1);
sfi_rec_unref (crec);
}
void
@@ -989,13 +989,13 @@ public:
void
ref ()
{
- g_return_if_fail (cobj != NULL && cobj->ref_count > 0);
+ assert_return (cobj != NULL && cobj->ref_count > 0);
g_object_ref (cobj);
}
void
unref ()
{
- g_return_if_fail (cobj != NULL && cobj->ref_count > 1);
+ assert_return (cobj != NULL && cobj->ref_count > 1);
g_object_unref (cobj);
}
void
diff --git a/sfi/sfidl-cbase.cc b/sfi/sfidl-cbase.cc
index 4204466..9275de7 100644
--- a/sfi/sfidl-cbase.cc
+++ b/sfi/sfidl-cbase.cc
@@ -614,7 +614,7 @@ void CodeGeneratorCBase::printChoiceConverters()
printf("const gchar*\n");
printf("%s_to_choice (%s value)\n", name.c_str(), arg.c_str());
printf("{\n");
- printf(" g_return_val_if_fail (value >= %d && value <= %d, NULL);\n", minval, maxval);
+ printf(" assert_return (value >= %d && value <= %d, NULL);\n", minval, maxval);
printf(" return sfi_constants_get_name (G_N_ELEMENTS (%s_vals), %s_vals, value);\n",
name.c_str(), name.c_str());
printf("}\n\n");
@@ -851,7 +851,7 @@ void CodeGeneratorCBase::printClientRecordMethodImpl()
printf("void\n");
printf("%s_free (%s rec)\n", lname.c_str(), arg.c_str());
printf("{\n");
- printf(" g_return_if_fail (rec != NULL);\n");
+ printf(" assert_return (rec != NULL);\n");
/* FIXME (tim): should free functions generally demand non-NULL structures? */
printf(" \n");
for (pi = ri->contents.begin(); pi != ri->contents.end(); pi++)
@@ -891,7 +891,7 @@ void CodeGeneratorCBase::printClientSequenceMethodImpl()
printf("void\n");
printf("%s_append (%s seq, %s element)\n", lname.c_str(), arg.c_str(), element.c_str());
printf("{\n");
- printf(" g_return_if_fail (seq != NULL);\n");
+ printf(" assert_return (seq != NULL);\n");
printf("\n");
printf(" seq->%s = (typeof (seq->%s)) g_realloc (seq->%s, (seq->n_%s + 1) * sizeof (seq->%s[0]));\n",
elements.c_str(), elements.c_str(), elements.c_str(), elements.c_str(), elements.c_str());
@@ -920,7 +920,7 @@ void CodeGeneratorCBase::printClientSequenceMethodImpl()
printf(" %s seq;\n", arg.c_str());
printf(" guint i, length;\n");
printf("\n");
- printf(" g_return_val_if_fail (sfi_seq != NULL, NULL);\n");
+ printf(" assert_return (sfi_seq != NULL, NULL);\n");
printf("\n");
printf(" length = sfi_seq_length (sfi_seq);\n");
printf(" seq = g_new0 (%s, 1);\n",mname.c_str());
@@ -942,7 +942,7 @@ void CodeGeneratorCBase::printClientSequenceMethodImpl()
printf(" SfiSeq *sfi_seq;\n");
printf(" guint i;\n");
printf("\n");
- printf(" g_return_val_if_fail (seq != NULL, NULL);\n");
+ printf(" assert_return (seq != NULL, NULL);\n");
printf("\n");
printf(" sfi_seq = sfi_seq_new ();\n");
printf(" for (i = 0; i < seq->n_%s; i++)\n", elements.c_str());
@@ -965,7 +965,7 @@ void CodeGeneratorCBase::printClientSequenceMethodImpl()
printf("void\n");
printf("%s_resize (%s seq, guint new_size)\n", lname.c_str(), arg.c_str());
printf("{\n");
- printf(" g_return_if_fail (seq != NULL);\n");
+ printf(" assert_return (seq != NULL);\n");
printf("\n");
if (element_i_free != "")
{
@@ -1002,7 +1002,7 @@ void CodeGeneratorCBase::printClientSequenceMethodImpl()
printf("{\n");
if (element_i_free != "")
printf(" guint i;\n\n");
- printf(" g_return_if_fail (seq != NULL);\n");
+ printf(" assert_return (seq != NULL);\n");
printf(" \n");
if (element_i_free != "")
{
diff --git a/sfi/sfidl-clientcxx.cc b/sfi/sfidl-clientcxx.cc
index 5688d33..ddff8b9 100644
--- a/sfi/sfidl-clientcxx.cc
+++ b/sfi/sfidl-clientcxx.cc
@@ -308,7 +308,7 @@ void CodeGeneratorClientCxx::printRecSeqImpl (NamespaceHelper& nspace)
printf(" %s seq;\n", cTypeRet (si->name));
printf(" guint i, length;\n");
printf("\n");
- printf(" g_return_val_if_fail (sfi_seq != NULL, seq);\n");
+ printf(" assert_return (sfi_seq != NULL, seq);\n");
printf("\n");
printf(" length = sfi_seq_length (sfi_seq);\n");
printf(" seq.resize (length);\n");
diff --git a/sfi/sfidl-corec.cc b/sfi/sfidl-corec.cc
index 770fad5..b38ead8 100644
--- a/sfi/sfidl-corec.cc
+++ b/sfi/sfidl-corec.cc
@@ -712,7 +712,7 @@ class CodeGeneratorCoreC : public CodeGenerator {
printf ("void\n");
printf ("%s_append (%s cseq, %s element)\n", lname.c_str(), arg.c_str(), element.c_str());
printf ("{\n");
- printf (" g_return_if_fail (cseq != NULL);\n");
+ printf (" assert_return (cseq != NULL);\n");
printf (" %s sh (0);\n", type);
printf (" sh.take (hack_cast (cseq));\n");
printf (" sh += %s;\n", cxx_handle (si->content.type, "element"));
@@ -747,7 +747,7 @@ class CodeGeneratorCoreC : public CodeGenerator {
printf ("void\n");
printf ("%s_resize (%s cseq, guint n)\n", lname.c_str(), arg.c_str());
printf ("{\n");
- printf (" g_return_if_fail (cseq != NULL);\n");
+ printf (" assert_return (cseq != NULL);\n");
printf (" %s sh (0);\n", type);
printf (" sh.take (hack_cast (cseq));\n");
printf (" sh.resize (n);\n");
diff --git a/sfi/sfidl-options.cc b/sfi/sfidl-options.cc
index 7187d48..1347481 100644
--- a/sfi/sfidl-options.cc
+++ b/sfi/sfidl-options.cc
@@ -14,7 +14,7 @@ using namespace Sfidl;
static Options *Options_the = 0;
Options *Options::the() {
- g_return_val_if_fail (Options_the != 0, 0);
+ assert_return (Options_the != 0, 0);
return Options_the;
};
@@ -40,9 +40,9 @@ bool Options::parse (int *argc_p, char **argv_p[], const Parser& parser)
char **argv;
unsigned int i, e;
- g_return_val_if_fail (argc_p != NULL, false);
- g_return_val_if_fail (argv_p != NULL, false);
- g_return_val_if_fail (*argc_p >= 0, false);
+ assert_return (argc_p != NULL, false);
+ assert_return (argv_p != NULL, false);
+ assert_return (*argc_p >= 0, false);
argc = *argc_p;
argv = *argv_p;
diff --git a/sfi/sfidl-parser.cc b/sfi/sfidl-parser.cc
index da59021..ef1b095 100644
--- a/sfi/sfidl-parser.cc
+++ b/sfi/sfidl-parser.cc
@@ -272,8 +272,8 @@ Parser::Parser () : options (*Options::the())
void
Parser::scannerMsgHandler (GScanner *scanner, gchar *message, gboolean is_error)
{
- g_return_if_fail (scanner != NULL);
- g_return_if_fail (scanner->user_data != NULL);
+ assert_return (scanner != NULL);
+ assert_return (scanner->user_data != NULL);
Parser *parser = static_cast<Parser *>(scanner->user_data);
if (scanner->line > 0 && parser->scannerLineInfo.size() >= scanner->line)
@@ -626,7 +626,7 @@ void Parser::preprocessContents (const String& input_filename)
bool Parser::insideInclude () const
{
int scanner_line = scanner->line - 1;
- g_return_val_if_fail (scanner_line >= 0 && scanner_line < (gint) scannerLineInfo.size(), false);
+ assert_return (scanner_line >= 0 && scanner_line < (gint) scannerLineInfo.size(), false);
return scannerLineInfo[scanner_line].isInclude;
}
diff --git a/sfi/sfidl-utils.cc b/sfi/sfidl-utils.cc
index b50bed1..3644c7a 100644
--- a/sfi/sfidl-utils.cc
+++ b/sfi/sfidl-utils.cc
@@ -39,7 +39,7 @@ symbolToList (const String& symbol)
list<String> result;
String current;
- g_return_val_if_fail (isCxxTypeName (symbol), result);
+ assert_return (isCxxTypeName (symbol), result);
for (String::const_iterator si = symbol.begin(); si != symbol.end(); si++)
{
diff --git a/sfi/sfifilecrawler.cc b/sfi/sfifilecrawler.cc
index cb91a55..1d5144c 100644
--- a/sfi/sfifilecrawler.cc
+++ b/sfi/sfifilecrawler.cc
@@ -60,7 +60,7 @@ sfi_file_crawler_new (void)
char*
sfi_file_crawler_pop (SfiFileCrawler *self)
{
- g_return_val_if_fail (self != NULL, NULL);
+ assert_return (self != NULL, NULL);
return (char*) sfi_ring_pop_head (&self->results);
}
@@ -74,8 +74,8 @@ void
sfi_file_crawler_set_cwd (SfiFileCrawler *self,
const gchar *cwd)
{
- g_return_if_fail (self != NULL);
- g_return_if_fail (cwd != NULL && g_path_is_absolute (cwd));
+ assert_return (self != NULL);
+ assert_return (cwd != NULL && g_path_is_absolute (cwd));
g_free (self->cwd);
self->cwd = g_strdup (cwd);
@@ -93,7 +93,7 @@ void
sfi_file_crawler_add_tests (SfiFileCrawler *self,
GFileTest tests)
{
- g_return_if_fail (self != NULL);
+ assert_return (self != NULL);
self->ptest = GFileTest (self->ptest | tests);
}
@@ -117,7 +117,7 @@ sfi_file_crawler_add_search_path (SfiFileCrawler *self,
const gchar *pattern_paths,
const gchar *file_pattern)
{
- g_return_if_fail (self != NULL);
+ assert_return (self != NULL);
if (pattern_paths)
{
const gchar *sep, *p = pattern_paths;
@@ -224,7 +224,7 @@ file_crawler_queue_abs_file_path (SfiFileCrawler *self,
/* seperate root */
sep = strchr (p, G_DIR_SEPARATOR);
- g_return_if_fail (sep != NULL); /* absolute paths must have a seperator */
+ assert_return (sep != NULL); /* absolute paths must have a seperator */
*sep++ = 0;
/* check root existance */
@@ -376,7 +376,7 @@ file_crawler_crawl_dpatterns (SfiFileCrawler *self)
gboolean
sfi_file_crawler_needs_crawl (SfiFileCrawler *self)
{
- g_return_val_if_fail (self != NULL, FALSE);
+ assert_return (self != NULL, FALSE);
return (self->dpatterns ||
self->pdqueue || self->dlist ||
@@ -395,7 +395,7 @@ sfi_file_crawler_needs_crawl (SfiFileCrawler *self)
void
sfi_file_crawler_crawl (SfiFileCrawler *self)
{
- g_return_if_fail (self != NULL);
+ assert_return (self != NULL);
if (self->dhandle)
{
#if INCREMENTAL_RESULTS
@@ -420,7 +420,7 @@ sfi_file_crawler_crawl (SfiFileCrawler *self)
void
sfi_file_crawler_destroy (SfiFileCrawler *self)
{
- g_return_if_fail (self != NULL);
+ assert_return (self != NULL);
g_free (self->cwd);
sfi_ring_free_deep (self->results, g_free);
@@ -476,7 +476,7 @@ sfi_make_dirpath (const gchar *dir)
gchar *str, *dirpath = NULL;
guint i;
- g_return_if_fail (dir != NULL);
+ assert_return (dir != NULL);
if (!g_path_is_absolute (dir))
{
diff --git a/sfi/sfiglue.cc b/sfi/sfiglue.cc
index 17f0265..5870828 100644
--- a/sfi/sfiglue.cc
+++ b/sfi/sfiglue.cc
@@ -20,7 +20,7 @@ void
sfi_glue_context_common_init (SfiGlueContext *context,
const SfiGlueContextTable *vtable)
{
- g_return_if_fail (context->table.base_iface == NULL);
+ assert_return (context->table.base_iface == NULL);
context->table = *vtable;
context->seq_hook_id = 1;
context->proxies = sfi_ustore_new ();
@@ -40,8 +40,8 @@ static RingPtrDataKey context_stack_key;
void
sfi_glue_context_push (SfiGlueContext *context)
{
- g_return_if_fail (context != NULL);
- g_return_if_fail (context->table.destroy != NULL);
+ assert_return (context != NULL);
+ assert_return (context->table.destroy != NULL);
Bse::ThreadInfo &self = Bse::ThreadInfo::self();
SfiRing *context_stack = self.swap_data (&context_stack_key, (SfiRing*) NULL); // prevents deletion
@@ -62,7 +62,7 @@ sfi_glue_context_pop (void)
{
Bse::ThreadInfo &self = Bse::ThreadInfo::self();
SfiRing *context_stack = self.swap_data (&context_stack_key, (SfiRing*) NULL); // prevents deletion
- g_return_if_fail (context_stack != NULL);
+ assert_return (context_stack != NULL);
context_stack = sfi_ring_remove_node (context_stack, context_stack);
self.set_data (&context_stack_key, context_stack);
}
@@ -125,8 +125,8 @@ _sfi_glue_proxy_request_notify (SfiProxy proxy,
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
gboolean connected;
- g_return_val_if_fail (proxy != 0, FALSE);
- g_return_val_if_fail (signal != NULL, FALSE);
+ assert_return (proxy != 0, FALSE);
+ assert_return (signal != NULL, FALSE);
connected = context->table.proxy_request_notify (context, proxy, signal, enable_notify);
if (!enable_notify) /* filter current event queue */
@@ -145,7 +145,7 @@ sfi_glue_context_destroy (SfiGlueContext *context)
{
void (*destroy) (SfiGlueContext *);
- g_return_if_fail (context != NULL);
+ assert_return (context != NULL);
sfi_glue_context_push (context);
sfi_glue_gc_run ();
@@ -180,7 +180,7 @@ sfi_glue_describe_proc (const gchar *proc_name)
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
SfiGlueProc *proc;
- g_return_val_if_fail (proc_name != NULL, NULL);
+ assert_return (proc_name != NULL, NULL);
proc = context->table.describe_proc (context, proc_name);
if (proc && !proc->name)
@@ -212,7 +212,7 @@ sfi_glue_list_method_names (const gchar *iface_name)
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
gchar **names;
- g_return_val_if_fail (iface_name != NULL, NULL);
+ assert_return (iface_name != NULL, NULL);
names = context->table.list_method_names (context, iface_name);
if (!names)
@@ -238,7 +238,7 @@ sfi_glue_iface_children (const gchar *iface_name)
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
gchar **names;
- g_return_val_if_fail (iface_name != NULL, NULL);
+ assert_return (iface_name != NULL, NULL);
names = context->table.iface_children (context, iface_name);
if (!names)
@@ -252,7 +252,7 @@ sfi_glue_describe_iface (const gchar *iface_name)
{
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
- g_return_val_if_fail (iface_name != NULL, NULL);
+ assert_return (iface_name != NULL, NULL);
SfiGlueIFace *iface = context->table.describe_iface (context, iface_name);
if (iface)
@@ -281,8 +281,8 @@ sfi_glue_call_seq (const gchar *proc_name,
{
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
- g_return_val_if_fail (proc_name != NULL, NULL);
- g_return_val_if_fail (params != NULL, NULL);
+ assert_return (proc_name != NULL, NULL);
+ assert_return (params != NULL, NULL);
GValue *value = context->table.exec_proc (context, proc_name, params);
if (value)
@@ -298,7 +298,7 @@ sfi_glue_call_valist (const gchar *proc_name,
guint8 arg_type = first_arg_type;
SfiSeq *seq;
- g_return_val_if_fail (proc_name != NULL, NULL);
+ assert_return (proc_name != NULL, NULL);
seq = sfi_seq_new ();
while (arg_type)
@@ -337,7 +337,7 @@ sfi_glue_vcall_void (const gchar *proc_name,
{
va_list var_args;
- g_return_if_fail (proc_name != NULL);
+ assert_return (proc_name != NULL);
va_start (var_args, first_arg_type);
GValue *rvalue = sfi_glue_call_valist (proc_name, first_arg_type, var_args);
@@ -355,7 +355,7 @@ sfi_glue_vcall_bool (const gchar *proc_name,
GValue *rvalue;
SfiBool retv = FALSE;
- g_return_val_if_fail (proc_name != NULL, FALSE);
+ assert_return (proc_name != NULL, FALSE);
va_start (var_args, first_arg_type);
rvalue = sfi_glue_call_valist (proc_name, first_arg_type, var_args);
@@ -376,7 +376,7 @@ sfi_glue_vcall_int (const gchar *proc_name,
GValue *rvalue;
SfiInt retv = 0;
- g_return_val_if_fail (proc_name != NULL, 0);
+ assert_return (proc_name != NULL, 0);
va_start (var_args, first_arg_type);
rvalue = sfi_glue_call_valist (proc_name, first_arg_type, var_args);
@@ -397,7 +397,7 @@ sfi_glue_vcall_num (const gchar *proc_name,
GValue *rvalue;
SfiNum retv = 0;
- g_return_val_if_fail (proc_name != NULL, 0);
+ assert_return (proc_name != NULL, 0);
va_start (var_args, first_arg_type);
rvalue = sfi_glue_call_valist (proc_name, first_arg_type, var_args);
@@ -418,7 +418,7 @@ sfi_glue_vcall_real (const gchar *proc_name,
GValue *rvalue;
SfiReal retv = 0;
- g_return_val_if_fail (proc_name != NULL, 0);
+ assert_return (proc_name != NULL, 0);
va_start (var_args, first_arg_type);
rvalue = sfi_glue_call_valist (proc_name, first_arg_type, var_args);
@@ -439,7 +439,7 @@ sfi_glue_vcall_string (const gchar *proc_name,
GValue *rvalue;
const char *retv = NULL;
- g_return_val_if_fail (proc_name != NULL, NULL);
+ assert_return (proc_name != NULL, NULL);
va_start (var_args, first_arg_type);
rvalue = sfi_glue_call_valist (proc_name, first_arg_type, var_args);
@@ -461,7 +461,7 @@ sfi_glue_vcall_choice (const gchar *proc_name,
GValue *rvalue;
const char *retv = NULL;
- g_return_val_if_fail (proc_name != NULL, NULL);
+ assert_return (proc_name != NULL, NULL);
va_start (var_args, first_arg_type);
rvalue = sfi_glue_call_valist (proc_name, first_arg_type, var_args);
@@ -483,7 +483,7 @@ sfi_glue_vcall_proxy (const gchar *proc_name,
GValue *rvalue;
SfiProxy retv = 0;
- g_return_val_if_fail (proc_name != NULL, 0);
+ assert_return (proc_name != NULL, 0);
va_start (var_args, first_arg_type);
rvalue = sfi_glue_call_valist (proc_name, first_arg_type, var_args);
@@ -504,7 +504,7 @@ sfi_glue_vcall_seq (const gchar *proc_name,
GValue *rvalue;
SfiSeq *retv = NULL;
- g_return_val_if_fail (proc_name != NULL, NULL);
+ assert_return (proc_name != NULL, NULL);
va_start (var_args, first_arg_type);
rvalue = sfi_glue_call_valist (proc_name, first_arg_type, var_args);
@@ -531,7 +531,7 @@ sfi_glue_vcall_rec (const gchar *proc_name,
GValue *rvalue;
SfiRec *retv = NULL;
- g_return_val_if_fail (proc_name != NULL, NULL);
+ assert_return (proc_name != NULL, NULL);
va_start (var_args, first_arg_type);
rvalue = sfi_glue_call_valist (proc_name, first_arg_type, var_args);
@@ -552,7 +552,7 @@ sfi_glue_vcall_fblock (const gchar *proc_name,
va_list var_args;
GValue *rvalue;
- g_return_val_if_fail (proc_name != NULL, NULL);
+ assert_return (proc_name != NULL, NULL);
va_start (var_args, first_arg_type);
rvalue = sfi_glue_call_valist (proc_name, first_arg_type, var_args);
@@ -573,7 +573,7 @@ sfi_glue_vcall_bblock (const gchar *proc_name,
va_list var_args;
GValue *rvalue;
- g_return_val_if_fail (proc_name != NULL, NULL);
+ assert_return (proc_name != NULL, NULL);
va_start (var_args, first_arg_type);
rvalue = sfi_glue_call_valist (proc_name, first_arg_type, var_args);
@@ -607,8 +607,8 @@ sfi_glue_iface_new (const gchar *iface_name)
SfiGlueIFace*
sfi_glue_iface_ref (SfiGlueIFace *iface)
{
- g_return_val_if_fail (iface != NULL, NULL);
- g_return_val_if_fail (iface->ref_count > 0, NULL);
+ assert_return (iface != NULL, NULL);
+ assert_return (iface->ref_count > 0, NULL);
iface->ref_count++;
return iface;
@@ -617,13 +617,13 @@ sfi_glue_iface_ref (SfiGlueIFace *iface)
void
sfi_glue_iface_unref (SfiGlueIFace *iface)
{
- g_return_if_fail (iface != NULL);
- g_return_if_fail (iface->ref_count > 0);
+ assert_return (iface != NULL);
+ assert_return (iface->ref_count > 0);
iface->ref_count--;
if (!iface->ref_count)
{
- g_return_if_fail (_sfi_glue_gc_test (iface, (void*) sfi_glue_iface_unref) == FALSE);
+ assert_return (_sfi_glue_gc_test (iface, (void*) sfi_glue_iface_unref) == FALSE);
g_free (iface->type_name);
g_strfreev (iface->ifaces);
g_strfreev (iface->props);
@@ -636,7 +636,7 @@ sfi_glue_proc_new (const gchar *proc_name)
{
SfiGlueProc *proc;
- g_return_val_if_fail (proc_name != NULL, NULL);
+ assert_return (proc_name != NULL, NULL);
proc = g_new0 (SfiGlueProc, 1);
proc->name = g_strdup (proc_name);
@@ -656,8 +656,8 @@ sfi_glue_proc_add_param (SfiGlueProc *proc,
{
guint i;
- g_return_if_fail (proc != NULL);
- g_return_if_fail (param != NULL);
+ assert_return (proc != NULL);
+ assert_return (param != NULL);
i = proc->n_params++;
proc->params = g_renew (GParamSpec*, proc->params, proc->n_params);
@@ -669,9 +669,9 @@ void
sfi_glue_proc_add_ret_param (SfiGlueProc *proc,
GParamSpec *param)
{
- g_return_if_fail (proc != NULL);
- g_return_if_fail (param != NULL);
- g_return_if_fail (proc->ret_param == NULL);
+ assert_return (proc != NULL);
+ assert_return (param != NULL);
+ assert_return (proc->ret_param == NULL);
proc->ret_param = g_param_spec_ref (param);
g_param_spec_sink (param);
@@ -680,8 +680,8 @@ sfi_glue_proc_add_ret_param (SfiGlueProc *proc,
SfiGlueProc*
sfi_glue_proc_ref (SfiGlueProc *proc)
{
- g_return_val_if_fail (proc != NULL, NULL);
- g_return_val_if_fail (proc->ref_count > 0, NULL);
+ assert_return (proc != NULL, NULL);
+ assert_return (proc->ref_count > 0, NULL);
proc->ref_count++;
return proc;
@@ -690,13 +690,13 @@ sfi_glue_proc_ref (SfiGlueProc *proc)
void
sfi_glue_proc_unref (SfiGlueProc *proc)
{
- g_return_if_fail (proc != NULL);
- g_return_if_fail (proc->ref_count > 0);
+ assert_return (proc != NULL);
+ assert_return (proc->ref_count > 0);
proc->ref_count--;
if (!proc->ref_count)
{
- g_return_if_fail (_sfi_glue_gc_test (proc, (void*) sfi_glue_proc_unref) == FALSE);
+ assert_return (_sfi_glue_gc_test (proc, (void*) sfi_glue_proc_unref) == FALSE);
if (proc->ret_param)
g_param_spec_unref (proc->ret_param);
@@ -758,10 +758,10 @@ sfi_glue_gc_add (gpointer data,
{
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
- g_return_if_fail (free_func != NULL);
- g_return_if_fail (_sfi_glue_gc_test (data, (void*) g_free) == FALSE); /* can't catch ref counted objects */
- g_return_if_fail (_sfi_glue_gc_test (data, (void*) g_strfreev) == FALSE);
- g_return_if_fail (_sfi_glue_gc_test (data, (void*) sfi_value_free) == FALSE);
+ assert_return (free_func != NULL);
+ assert_return (_sfi_glue_gc_test (data, (void*) g_free) == FALSE); /* can't catch ref counted objects */
+ assert_return (_sfi_glue_gc_test (data, (void*) g_strfreev) == FALSE);
+ assert_return (_sfi_glue_gc_test (data, (void*) sfi_value_free) == FALSE);
GcEntry *entry = g_new (GcEntry, 1);
entry->data = data;
@@ -787,12 +787,12 @@ sfi_glue_gc_remove (gpointer data,
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
GcEntry key, *gc_entry;
- g_return_if_fail (free_func != NULL);
+ assert_return (free_func != NULL);
key.data = data;
key.free_func = SfiGlueGcFreeFunc (free_func);
gc_entry = (GcEntry*) g_hash_table_lookup (context->gc_hash, &key);
- g_return_if_fail (gc_entry != NULL);
+ assert_return (gc_entry != NULL);
g_hash_table_steal (context->gc_hash, gc_entry);
g_free (gc_entry);
}
@@ -804,12 +804,12 @@ sfi_glue_gc_free_now (gpointer data,
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
GcEntry key, *gc_entry;
- g_return_if_fail (free_func != NULL);
+ assert_return (free_func != NULL);
key.data = data;
key.free_func = SfiGlueGcFreeFunc (free_func);
gc_entry = (GcEntry*) g_hash_table_lookup (context->gc_hash, &key);
- g_return_if_fail (gc_entry != NULL);
+ assert_return (gc_entry != NULL);
g_hash_table_steal (context->gc_hash, gc_entry);
g_free (gc_entry);
key.free_func (key.data);
diff --git a/sfi/sfigluecodec.cc b/sfi/sfigluecodec.cc
index a832d9d..8beb6b2 100644
--- a/sfi/sfigluecodec.cc
+++ b/sfi/sfigluecodec.cc
@@ -86,7 +86,7 @@ sfi_glue_encoder_context (SfiComPort *port)
};
SfiGlueEncoder *encoder;
- g_return_val_if_fail (port != NULL, NULL);
+ assert_return (port != NULL, NULL);
encoder = g_new0 (SfiGlueEncoder, 1);
sfi_glue_context_common_init (&encoder->context, &encoder_vtable);
@@ -897,8 +897,8 @@ sfi_glue_context_decoder (SfiComPort *port,
{
SfiGlueDecoder *decoder;
- g_return_val_if_fail (port != NULL, NULL);
- g_return_val_if_fail (context != NULL, NULL);
+ assert_return (port != NULL, NULL);
+ assert_return (context != NULL, NULL);
decoder = g_new0 (SfiGlueDecoder, 1);
decoder->context = context;
@@ -914,8 +914,8 @@ sfi_glue_decoder_add_handler (SfiGlueDecoder *decoder,
SfiGlueDecoderClientMsg func,
gpointer user_data)
{
- g_return_if_fail (decoder != NULL);
- g_return_if_fail (func != NULL);
+ assert_return (decoder != NULL);
+ assert_return (func != NULL);
uint i = decoder->n_chandler++;
decoder->chandler = (SfiGlueDecoder::ClientMsg*) g_realloc (decoder->chandler, sizeof
(decoder->chandler[0]) * decoder->n_chandler);
decoder->chandler[i].client_msg = func;
@@ -927,7 +927,7 @@ sfi_glue_decoder_pending (SfiGlueDecoder *decoder)
{
gboolean pending;
- g_return_val_if_fail (decoder != NULL, FALSE);
+ assert_return (decoder != NULL, FALSE);
pending = decoder->outgoing || decoder->incoming;
if (!pending)
@@ -952,7 +952,7 @@ sfi_glue_decoder_dispatch (SfiGlueDecoder *decoder)
{
SfiSeq *seq;
- g_return_if_fail (decoder != NULL);
+ assert_return (decoder != NULL);
sfi_glue_context_push (decoder->context);
@@ -1032,7 +1032,7 @@ sfi_glue_decoder_list_poll_fds (SfiGlueDecoder *decoder)
SfiRing *ring;
guint n;
- g_return_val_if_fail (decoder != NULL, NULL);
+ assert_return (decoder != NULL, NULL);
sfi_glue_context_push (decoder->context);
ring = sfi_ring_copy (sfi_glue_context_list_poll_fds ());
@@ -1048,7 +1048,7 @@ sfi_glue_decoder_destroy (SfiGlueDecoder *decoder)
{
SfiRing *ring;
- g_return_if_fail (decoder != NULL);
+ assert_return (decoder != NULL);
sfi_com_port_unref (decoder->port);
for (ring = decoder->outgoing; ring; ring = sfi_ring_walk (ring, decoder->outgoing))
diff --git a/sfi/sfiglueproxy.cc b/sfi/sfiglueproxy.cc
index cd6b7b0..c11d1f4 100644
--- a/sfi/sfiglueproxy.cc
+++ b/sfi/sfiglueproxy.cc
@@ -191,7 +191,7 @@ _sfi_glue_context_clear_proxies (SfiGlueContext *context)
{
GSList *plist = NULL;
- g_return_if_fail (context != NULL);
+ assert_return (context != NULL);
/* this is called during context destruction, so remote is probably down already */
@@ -217,7 +217,7 @@ sfi_glue_proxy_release (SfiGlueContext *context,
SfiProxy proxy)
{
Proxy *p = peek_proxy (context, proxy);
- g_return_if_fail (proxy != 0);
+ assert_return (proxy != 0);
if (p)
destroy_glue_proxy (context, p, TRUE);
else
@@ -231,7 +231,7 @@ sfi_glue_proxy_signal (SfiGlueContext *context,
{
Proxy *p;
- g_return_if_fail (proxy > 0 && signal);
+ assert_return (proxy > 0 && signal);
p = peek_proxy (context, proxy);
if (p)
@@ -271,9 +271,9 @@ default_glue_marshal (GClosure *closure,
{
gpointer arg0, argN;
- g_return_if_fail (return_value == NULL);
- g_return_if_fail (n_param_values >= 1 && n_param_values <= 1 + SFI_VMARSHAL_MAX_ARGS);
- g_return_if_fail (SFI_VALUE_HOLDS_PROXY (param_values));
+ assert_return (return_value == NULL);
+ assert_return (n_param_values >= 1 && n_param_values <= 1 + SFI_VMARSHAL_MAX_ARGS);
+ assert_return (SFI_VALUE_HOLDS_PROXY (param_values));
arg0 = (gpointer) sfi_value_get_proxy (param_values);
if (G_CCLOSURE_SWAP_DATA (closure))
@@ -299,9 +299,9 @@ sfi_glue_signal_connect_closure (SfiProxy proxy,
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
Proxy *p;
- g_return_val_if_fail (proxy > 0, 0);
- g_return_val_if_fail (signal != NULL, 0);
- g_return_val_if_fail (closure != NULL, 0);
+ assert_return (proxy > 0, 0);
+ assert_return (signal != NULL, 0);
+ assert_return (closure != NULL, 0);
g_closure_ref (closure);
g_closure_sink (closure);
@@ -360,8 +360,8 @@ sfi_glue_signal_disconnect (SfiProxy proxy,
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
Proxy *p;
- g_return_if_fail (proxy > 0);
- g_return_if_fail (connection_id > 0);
+ assert_return (proxy > 0);
+ assert_return (connection_id > 0);
p = peek_proxy (context, proxy);
if (!p)
@@ -405,8 +405,8 @@ _sfi_glue_signal_find_closures (SfiGlueContext *context,
GSList *ids = NULL;
Proxy *p;
- g_return_val_if_fail (proxy > 0, NULL);
- g_return_val_if_fail (search_data != NULL, NULL);
+ assert_return (proxy > 0, NULL);
+ assert_return (search_data != NULL, NULL);
p = peek_proxy (context, proxy);
if (p && signal)
@@ -452,7 +452,7 @@ sfi_glue_proxy_connect (SfiProxy proxy,
{
va_list var_args;
- g_return_if_fail (proxy > 0);
+ assert_return (proxy > 0);
va_start (var_args, signal);
while (signal)
@@ -493,7 +493,7 @@ sfi_glue_proxy_disconnect (SfiProxy proxy,
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
va_list var_args;
- g_return_if_fail (proxy > 0);
+ assert_return (proxy > 0);
va_start (var_args, signal);
while (signal)
@@ -538,8 +538,8 @@ sfi_glue_proxy_pending (SfiProxy proxy,
{
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
- g_return_val_if_fail (proxy > 0, FALSE);
- g_return_val_if_fail (callback != NULL, FALSE);
+ assert_return (proxy > 0, FALSE);
+ assert_return (callback != NULL, FALSE);
GSList *slist = _sfi_glue_signal_find_closures (context, proxy, signal, data, (void*) callback, FALSE);
g_slist_free (slist);
@@ -551,7 +551,7 @@ _sfi_glue_proxy_watch_release (SfiProxy proxy)
{
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
- g_return_val_if_fail (proxy != 0, FALSE);
+ assert_return (proxy != 0, FALSE);
return context->table.proxy_watch_release (context, proxy);
}
@@ -561,7 +561,7 @@ _sfi_glue_proxy_processed_notify (guint notify_id)
{
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
- g_return_if_fail (notify_id != 0);
+ assert_return (notify_id != 0);
return context->table.proxy_processed_notify (context, notify_id);
}
@@ -573,7 +573,7 @@ sfi_glue_proxy_get_qdata (SfiProxy proxy,
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
Proxy *p = peek_proxy (context, proxy);
- g_return_val_if_fail (proxy != 0, NULL);
+ assert_return (proxy != 0, NULL);
return p && quark ? g_datalist_id_get_data (&p->qdata, quark) : NULL;
}
@@ -585,7 +585,7 @@ sfi_glue_proxy_steal_qdata (SfiProxy proxy,
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
Proxy *p = peek_proxy (context, proxy);
- g_return_val_if_fail (proxy != 0, NULL);
+ assert_return (proxy != 0, NULL);
return p && quark ? g_datalist_id_remove_no_notify (&p->qdata, quark) : NULL;
}
@@ -599,8 +599,8 @@ sfi_glue_proxy_set_qdata_full (SfiProxy proxy,
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
Proxy *p;
- g_return_if_fail (proxy != 0);
- g_return_if_fail (quark != 0);
+ assert_return (proxy != 0);
+ assert_return (quark != 0);
p = fetch_proxy (context, proxy);
if (!p)
@@ -650,8 +650,8 @@ sfi_glue_proxy_weak_ref (SfiProxy proxy,
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
Proxy *p;
- g_return_if_fail (proxy > 0);
- g_return_if_fail (weak_notify != NULL);
+ assert_return (proxy > 0);
+ assert_return (weak_notify != NULL);
p = fetch_proxy (context, proxy);
if (!p)
@@ -693,8 +693,8 @@ sfi_glue_proxy_weak_unref (SfiProxy proxy,
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
Proxy *p;
- g_return_if_fail (proxy > 0);
- g_return_if_fail (weak_notify != NULL);
+ assert_return (proxy > 0);
+ assert_return (weak_notify != NULL);
p = peek_proxy (context, proxy);
if (!p)
@@ -732,7 +732,7 @@ sfi_glue_proxy_iface (SfiProxy proxy)
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
gchar *iface;
- g_return_val_if_fail (proxy != 0, NULL);
+ assert_return (proxy != 0, NULL);
iface = context->table.proxy_iface (context, proxy);
@@ -745,7 +745,7 @@ gboolean
sfi_glue_proxy_is_a (SfiProxy proxy,
const gchar *type)
{
- g_return_val_if_fail (type != NULL, FALSE);
+ assert_return (type != NULL, FALSE);
if (proxy)
{
@@ -763,8 +763,8 @@ sfi_glue_proxy_get_pspec (SfiProxy proxy,
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
GParamSpec *pspec;
- g_return_val_if_fail (proxy != 0, NULL);
- g_return_val_if_fail (name != NULL, NULL);
+ assert_return (proxy != 0, NULL);
+ assert_return (name != NULL, NULL);
pspec = context->table.proxy_get_pspec (context, proxy, name);
if (pspec)
@@ -778,8 +778,8 @@ sfi_glue_proxy_get_pspec_scategory (SfiProxy proxy,
{
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
- g_return_val_if_fail (proxy != 0, SfiSCategory (0));
- g_return_val_if_fail (name != NULL, SfiSCategory (0));
+ assert_return (proxy != 0, SfiSCategory (0));
+ assert_return (name != NULL, SfiSCategory (0));
return context->table.proxy_get_pspec_scategory (context, proxy, name);
}
@@ -793,7 +793,7 @@ sfi_glue_proxy_list_properties (SfiProxy proxy,
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
gchar **props;
- g_return_val_if_fail (proxy != 0, NULL);
+ assert_return (proxy != 0, NULL);
if (first_ancestor && !first_ancestor[0])
first_ancestor = NULL;
@@ -816,9 +816,9 @@ sfi_glue_proxy_set_property (SfiProxy proxy,
{
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
- g_return_if_fail (proxy != 0);
- g_return_if_fail (prop != NULL);
- g_return_if_fail (G_IS_VALUE (value));
+ assert_return (proxy != 0);
+ assert_return (prop != NULL);
+ assert_return (G_IS_VALUE (value));
context->table.proxy_set_property (context, proxy, prop, value);
}
@@ -830,8 +830,8 @@ sfi_glue_proxy_get_property (SfiProxy proxy,
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
GValue *value;
- g_return_val_if_fail (proxy != 0, NULL);
- g_return_val_if_fail (prop != NULL, NULL);
+ assert_return (proxy != 0, NULL);
+ assert_return (prop != NULL, NULL);
value = context->table.proxy_get_property (context, proxy, prop);
if (value)
@@ -847,7 +847,7 @@ sfi_glue_proxy_set (SfiProxy proxy,
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
va_list var_args;
- g_return_if_fail (proxy != 0);
+ assert_return (proxy != 0);
va_start (var_args, prop);
while (prop)
@@ -885,7 +885,7 @@ sfi_glue_proxy_get (SfiProxy proxy,
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
va_list var_args;
- g_return_if_fail (proxy != 0);
+ assert_return (proxy != 0);
va_start (var_args, prop);
while (prop)
@@ -916,7 +916,7 @@ _sfi_glue_proxy_dispatch_event (SfiSeq *event)
static gboolean glue_proxy_dispatching = FALSE;
SfiGlueContext *context = sfi_glue_fetch_context (G_STRLOC);
- g_return_if_fail (glue_proxy_dispatching == FALSE);
+ assert_return (glue_proxy_dispatching == FALSE);
glue_proxy_dispatching = TRUE;
diff --git a/sfi/sfimemory.cc b/sfi/sfimemory.cc
index c6e766d..1d3a5de 100644
--- a/sfi/sfimemory.cc
+++ b/sfi/sfimemory.cc
@@ -92,7 +92,7 @@ sfi_alloc_memblock (gsize block_size)
{
uint8 *cmem;
size_t *debug_size;
- g_return_val_if_fail (block_size >= sizeof (gpointer), NULL); /* cache-link size */
+ assert_return (block_size >= sizeof (gpointer), NULL); /* cache-link size */
cmem = (uint8*) low_alloc (block_size + DBG8_SIZE);
debug_size = (gsize*) cmem;
*debug_size = block_size;
@@ -105,7 +105,7 @@ sfi_free_memblock (gsize block_size,
{
size_t *debug_size;
uint8 *cmem;
- g_return_if_fail (mem != NULL);
+ assert_return (mem != NULL);
cmem = (uint8*) mem;
cmem -= DBG8_SIZE;
debug_size = (gsize*) cmem;
@@ -155,8 +155,8 @@ _sfi_free_node_list (gpointer mem,
struct LinkedData { gpointer data; LinkedData *next; };
LinkedData *tmp, *node = (LinkedData*) mem;
- g_return_if_fail (node != NULL);
- g_return_if_fail (node_size >= 2 * sizeof (gpointer));
+ assert_return (node != NULL);
+ assert_return (node_size >= 2 * sizeof (gpointer));
/* FIXME: this can be optimized to an O(1) operation with T-style links in mem-caches */
do
diff --git a/sfi/sfinote.cc b/sfi/sfinote.cc
index 988a579..28fa908 100644
--- a/sfi/sfinote.cc
+++ b/sfi/sfinote.cc
@@ -63,7 +63,7 @@ sfi_note_from_string_err (const gchar *note_string,
if (error_p)
*error_p = NULL;
- g_return_val_if_fail (note_string != NULL, SFI_NOTE_VOID);
+ assert_return (note_string != NULL, SFI_NOTE_VOID);
string = freeme = g_strdup_stripped (note_string);
g_ascii_strdown (string, -1);
@@ -153,7 +153,7 @@ sfi_note_examine (gint note,
guint semitone;
gint octave;
- g_return_if_fail (SFI_NOTE_IS_VALID (note));
+ assert_return (SFI_NOTE_IS_VALID (note));
semitone = note % 12 + (9 - (SFI_KAMMER_NOTE % 12));
note -= semitone;
diff --git a/sfi/sfiparams.cc b/sfi/sfiparams.cc
index 06f453b..085e6b6 100644
--- a/sfi/sfiparams.cc
+++ b/sfi/sfiparams.cc
@@ -452,7 +452,7 @@ sfi_pspec_bool (const gchar *name,
SfiBool default_value,
const gchar *hints)
{
- g_return_val_if_fail (default_value == TRUE || default_value == FALSE, NULL);
+ assert_return (default_value == TRUE || default_value == FALSE, NULL);
GParamSpec *pspec = g_param_spec_boolean (name, NULL_CHECKED (nick), NULL_CHECKED (blurb), default_value,
GParamFlags (0));
sfi_pspec_set_options (pspec, hints);
@@ -470,9 +470,9 @@ sfi_pspec_int (const gchar *name,
SfiInt stepping,
const gchar *hints)
{
- g_return_val_if_fail (default_value >= minimum_value && default_value <= maximum_value, NULL);
- g_return_val_if_fail (minimum_value <= maximum_value, NULL);
- g_return_val_if_fail (minimum_value + stepping <= maximum_value, NULL);
+ assert_return (default_value >= minimum_value && default_value <= maximum_value, NULL);
+ assert_return (minimum_value <= maximum_value, NULL);
+ assert_return (minimum_value + stepping <= maximum_value, NULL);
GParamSpec *pspec = g_param_spec_int (name, NULL_CHECKED (nick), NULL_CHECKED (blurb), minimum_value,
maximum_value, default_value, GParamFlags (0));
sfi_pspec_set_options (pspec, hints);
@@ -491,9 +491,9 @@ sfi_pspec_num (const gchar *name,
SfiNum stepping,
const gchar *hints)
{
- g_return_val_if_fail (default_value >= minimum_value && default_value <= maximum_value, NULL);
- g_return_val_if_fail (minimum_value <= maximum_value, NULL);
- g_return_val_if_fail (minimum_value + stepping <= maximum_value, NULL);
+ assert_return (default_value >= minimum_value && default_value <= maximum_value, NULL);
+ assert_return (minimum_value <= maximum_value, NULL);
+ assert_return (minimum_value + stepping <= maximum_value, NULL);
GParamSpec *pspec = g_param_spec_int64 (name, NULL_CHECKED (nick), NULL_CHECKED (blurb), minimum_value,
maximum_value, default_value, GParamFlags (0));
sfi_pspec_set_options (pspec, hints);
@@ -512,9 +512,9 @@ sfi_pspec_real (const gchar *name,
SfiReal stepping,
const gchar *hints)
{
- g_return_val_if_fail (default_value >= minimum_value && default_value <= maximum_value, NULL);
- g_return_val_if_fail (minimum_value <= maximum_value, NULL);
- g_return_val_if_fail (minimum_value + stepping <= maximum_value, NULL);
+ assert_return (default_value >= minimum_value && default_value <= maximum_value, NULL);
+ assert_return (minimum_value <= maximum_value, NULL);
+ assert_return (minimum_value + stepping <= maximum_value, NULL);
GParamSpec *pspec = g_param_spec_double (name, NULL_CHECKED (nick), NULL_CHECKED (blurb), minimum_value,
maximum_value, default_value, GParamFlags (0));
sfi_pspec_set_options (pspec, hints);
@@ -537,8 +537,8 @@ sfi_pspec_log_scale (const gchar *name,
{
GParamSpec *pspec;
- g_return_val_if_fail (n_steps > 0, NULL);
- g_return_val_if_fail (base > 0, NULL);
+ assert_return (n_steps > 0, NULL);
+ assert_return (base > 0, NULL);
pspec = sfi_pspec_real (name, nick, blurb, default_value, minimum_value, maximum_value, stepping, hints);
if (pspec)
@@ -570,7 +570,7 @@ sfi_pspec_choice (const gchar *name,
SfiChoiceValues static_const_cvalues,
const gchar *hints)
{
- g_return_val_if_fail (static_const_cvalues.n_values >= 1, NULL);
+ assert_return (static_const_cvalues.n_values >= 1, NULL);
GParamSpec *pspec = param_spec_internal (SFI_TYPE_PARAM_CHOICE, name, NULL_CHECKED (nick), NULL_CHECKED
(blurb), GParamFlags (0));
sfi_pspec_set_options (pspec, hints);
@@ -634,7 +634,7 @@ sfi_pspec_seq (const gchar *name,
const gchar *hints)
{
if (element_spec)
- g_return_val_if_fail (G_IS_PARAM_SPEC (element_spec), NULL);
+ assert_return (G_IS_PARAM_SPEC (element_spec), NULL);
GParamSpec *pspec = param_spec_internal (SFI_TYPE_PARAM_SEQ, name, NULL_CHECKED (nick), NULL_CHECKED
(blurb), GParamFlags (0));
sfi_pspec_set_options (pspec, hints);
@@ -706,11 +706,11 @@ sfi_pspec_note (const gchar *name,
if (default_value == SFI_NOTE_VOID)
{
- g_return_val_if_fail (min_note <= max_note, NULL);
- g_return_val_if_fail (default_value == SFI_NOTE_VOID && allow_void == TRUE, NULL);
+ assert_return (min_note <= max_note, NULL);
+ assert_return (default_value == SFI_NOTE_VOID && allow_void == TRUE, NULL);
}
else
- g_return_val_if_fail (default_value >= min_note && default_value <= max_note, NULL);
+ assert_return (default_value >= min_note && default_value <= max_note, NULL);
pspec = param_spec_internal (SFI_TYPE_PARAM_NOTE, name, NULL_CHECKED (nick), NULL_CHECKED (blurb),
GParamFlags (0));
nspec = SFI_PSPEC_NOTE (pspec);
@@ -743,7 +743,7 @@ sfi_boxed_type_set_rec_fields (GType boxed_type,
const SfiRecFields static_const_fields)
{
BoxedInfo *binfo = (BoxedInfo*) g_type_get_qdata (boxed_type, quark_boxed_info);
- g_return_if_fail (G_TYPE_IS_BOXED (boxed_type));
+ assert_return (G_TYPE_IS_BOXED (boxed_type));
if (static_const_fields.n_fields)
{
binfo = (BoxedInfo*) g_realloc (binfo, (sizeof (BoxedInfo) +
@@ -765,7 +765,7 @@ sfi_boxed_type_get_rec_fields (GType boxed_type)
{
BoxedInfo *binfo = (BoxedInfo*) g_type_get_qdata (boxed_type, quark_boxed_info);
SfiRecFields rfields = { 0, NULL };
- g_return_val_if_fail (G_TYPE_IS_BOXED (boxed_type), rfields);
+ assert_return (G_TYPE_IS_BOXED (boxed_type), rfields);
if (binfo && binfo->boxed_kind == BOXED_RECORD)
{
rfields.n_fields = binfo->n_fields;
@@ -779,7 +779,7 @@ sfi_boxed_type_set_seq_element (GType boxed_type,
GParamSpec *element)
{
BoxedInfo *binfo = (BoxedInfo*) g_type_get_qdata (boxed_type, quark_boxed_info);
- g_return_if_fail (G_TYPE_IS_BOXED (boxed_type));
+ assert_return (G_TYPE_IS_BOXED (boxed_type));
guint i;
for (i = 0; i < (binfo ? binfo->n_fields : 0); i++)
if (binfo->fields[i])
@@ -805,7 +805,7 @@ sfi_boxed_type_get_seq_element (GType boxed_type)
{
BoxedInfo *binfo = (BoxedInfo*) g_type_get_qdata (boxed_type, quark_boxed_info);
GParamSpec *pspec = NULL;
- g_return_val_if_fail (G_TYPE_IS_BOXED (boxed_type), NULL);
+ assert_return (G_TYPE_IS_BOXED (boxed_type), NULL);
if (binfo && binfo->boxed_kind == BOXED_SEQUENCE)
pspec = binfo->fields[0];
return pspec;
@@ -815,7 +815,7 @@ void
sfi_enum_type_set_choice_value_getter (GType gtype,
SfiChoiceValueGetter cvgetter)
{
- g_return_if_fail (G_TYPE_IS_ENUM (gtype));
+ assert_return (G_TYPE_IS_ENUM (gtype));
if (g_type_get_qdata (gtype, quark_tmp_choice_values) != NULL)
g_warning ("%s: unsetting choice value getter of type `%s' while keeping old choice value references",
G_STRFUNC, g_type_name (gtype));
g_type_set_qdata (gtype, quark_enum_choice_value_getter, (void*) cvgetter);
@@ -853,8 +853,8 @@ typedef struct {
static void
tmp_record_fields_unref (TmpRecordFields *trf)
{
- g_return_if_fail (trf != NULL);
- g_return_if_fail (trf->ref_count > 0);
+ assert_return (trf != NULL);
+ assert_return (trf->ref_count > 0);
trf->ref_count--;
if (!trf->ref_count)
@@ -911,8 +911,8 @@ typedef struct {
static void
tmp_choice_values_unref (TmpChoiceValues *tcv)
{
- g_return_if_fail (tcv != NULL);
- g_return_if_fail (tcv->ref_count > 0);
+ assert_return (tcv != NULL);
+ assert_return (tcv->ref_count > 0);
tcv->ref_count--;
if (!tcv->ref_count)
@@ -1015,7 +1015,7 @@ sfi_pspec_choice_from_enum (GParamSpec *enum_pspec)
TmpChoiceValues *tcv;
GEnumValue *default_evalue;
- g_return_val_if_fail (G_IS_PARAM_SPEC_ENUM (enum_pspec), NULL);
+ assert_return (G_IS_PARAM_SPEC_ENUM (enum_pspec), NULL);
espec = G_PARAM_SPEC_ENUM (enum_pspec);
tcv = tmp_choice_values_from_enum (espec->enum_class);
@@ -1035,7 +1035,7 @@ sfi_pspec_proxy_from_object (GParamSpec *object_pspec)
{
GParamSpec *pspec;
- g_return_val_if_fail (G_IS_PARAM_SPEC_OBJECT (object_pspec), NULL);
+ assert_return (G_IS_PARAM_SPEC_OBJECT (object_pspec), NULL);
pspec = sfi_pspec_proxy (object_pspec->name,
object_pspec->_nick,
@@ -1050,7 +1050,7 @@ sfi_pspec_to_serializable (GParamSpec *xpspec)
{
GParamSpec *pspec = NULL;
- g_return_val_if_fail (G_IS_PARAM_SPEC (xpspec), NULL);
+ assert_return (G_IS_PARAM_SPEC (xpspec), NULL);
if (sfi_categorize_pspec (xpspec))
pspec = g_param_spec_ref (xpspec);
@@ -1087,7 +1087,7 @@ GParamSpec *
sfi_pspec_set_group (GParamSpec *pspec,
const gchar *group)
{
- g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), pspec);
+ assert_return (G_IS_PARAM_SPEC (pspec), pspec);
g_param_spec_set_qdata_full (pspec, quark_param_group, g_strdup (group), group ? g_free : NULL);
return pspec;
@@ -1096,7 +1096,7 @@ sfi_pspec_set_group (GParamSpec *pspec,
const gchar*
sfi_pspec_get_group (GParamSpec *pspec)
{
- g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), NULL);
+ assert_return (G_IS_PARAM_SPEC (pspec), NULL);
return (const char*) g_param_spec_get_qdata (pspec, quark_param_group);
}
@@ -1104,8 +1104,8 @@ void
sfi_pspec_set_owner (GParamSpec *pspec,
const gchar *owner)
{
- g_return_if_fail (G_IS_PARAM_SPEC (pspec));
- g_return_if_fail (owner != NULL);
+ assert_return (G_IS_PARAM_SPEC (pspec));
+ assert_return (owner != NULL);
g_param_spec_set_qdata_full (pspec, quark_param_owner, g_strdup (owner), g_free);
}
@@ -1113,7 +1113,7 @@ sfi_pspec_set_owner (GParamSpec *pspec,
const gchar*
sfi_pspec_get_owner (GParamSpec *pspec)
{
- g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), NULL);
+ assert_return (G_IS_PARAM_SPEC (pspec), NULL);
const char *owner = (char*) g_param_spec_get_qdata (pspec, quark_param_owner);
if (!owner && pspec->owner_type)
@@ -1131,7 +1131,7 @@ sfi_pspec_set_void_note (GParamSpec *pspec,
{
SfiParamSpecNote *nspec;
- g_return_if_fail (SFI_IS_PSPEC_NOTE (pspec));
+ assert_return (SFI_IS_PSPEC_NOTE (pspec));
nspec = SFI_PSPEC_NOTE (pspec);
nspec->allow_void = allow_void != FALSE;
@@ -1141,7 +1141,7 @@ sfi_pspec_set_void_note (GParamSpec *pspec,
gboolean
sfi_pspec_allows_void_note (GParamSpec *pspec)
{
- g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE);
+ assert_return (G_IS_PARAM_SPEC (pspec), FALSE);
return SFI_IS_PSPEC_NOTE (pspec) && SFI_PSPEC_NOTE (pspec)->allow_void;
}
@@ -1155,7 +1155,7 @@ typedef struct {
SfiBool
sfi_pspec_get_bool_default (GParamSpec *pspec)
{
- g_return_val_if_fail (SFI_IS_PSPEC_BOOL (pspec), FALSE);
+ assert_return (SFI_IS_PSPEC_BOOL (pspec), FALSE);
return SFI_PSPEC_BOOL (pspec)->default_value;
}
@@ -1163,7 +1163,7 @@ sfi_pspec_get_bool_default (GParamSpec *pspec)
SfiInt
sfi_pspec_get_int_default (GParamSpec *pspec)
{
- g_return_val_if_fail (SFI_IS_PSPEC_INT (pspec), 0);
+ assert_return (SFI_IS_PSPEC_INT (pspec), 0);
return SFI_PSPEC_INT (pspec)->default_value;
}
@@ -1176,7 +1176,7 @@ sfi_pspec_get_int_range (GParamSpec *pspec,
{
SfiParamSpecInt *ispec;
- g_return_if_fail (SFI_IS_PSPEC_INT (pspec));
+ assert_return (SFI_IS_PSPEC_INT (pspec));
ispec = SFI_PSPEC_INT (pspec);
if (minimum_value)
@@ -1190,7 +1190,7 @@ sfi_pspec_get_int_range (GParamSpec *pspec,
SfiNum
sfi_pspec_get_num_default (GParamSpec *pspec)
{
- g_return_val_if_fail (SFI_IS_PSPEC_NUM (pspec), 0);
+ assert_return (SFI_IS_PSPEC_NUM (pspec), 0);
return SFI_PSPEC_NUM (pspec)->default_value;
}
@@ -1203,7 +1203,7 @@ sfi_pspec_get_num_range (GParamSpec *pspec,
{
SfiParamSpecNum *nspec;
- g_return_if_fail (SFI_IS_PSPEC_NUM (pspec));
+ assert_return (SFI_IS_PSPEC_NUM (pspec));
nspec = SFI_PSPEC_NUM (pspec);
if (minimum_value)
@@ -1217,7 +1217,7 @@ sfi_pspec_get_num_range (GParamSpec *pspec,
SfiReal
sfi_pspec_get_real_default (GParamSpec *pspec)
{
- g_return_val_if_fail (SFI_IS_PSPEC_REAL (pspec), 0);
+ assert_return (SFI_IS_PSPEC_REAL (pspec), 0);
return SFI_PSPEC_REAL (pspec)->default_value;
}
@@ -1230,7 +1230,7 @@ sfi_pspec_get_real_range (GParamSpec *pspec,
{
SfiParamSpecReal *nspec;
- g_return_if_fail (SFI_IS_PSPEC_REAL (pspec));
+ assert_return (SFI_IS_PSPEC_REAL (pspec));
nspec = SFI_PSPEC_REAL (pspec);
if (minimum_value)
@@ -1244,7 +1244,7 @@ sfi_pspec_get_real_range (GParamSpec *pspec,
const gchar*
sfi_pspec_get_string_default (GParamSpec *pspec)
{
- g_return_val_if_fail (SFI_IS_PSPEC_STRING (pspec), NULL);
+ assert_return (SFI_IS_PSPEC_STRING (pspec), NULL);
return SFI_PSPEC_STRING (pspec)->default_value;
}
@@ -1252,7 +1252,7 @@ sfi_pspec_get_string_default (GParamSpec *pspec)
const gchar*
sfi_pspec_get_choice_default (GParamSpec *pspec)
{
- g_return_val_if_fail (SFI_IS_PSPEC_CHOICE (pspec), NULL);
+ assert_return (SFI_IS_PSPEC_CHOICE (pspec), NULL);
return G_PARAM_SPEC_STRING (pspec)->default_value;
}
@@ -1263,7 +1263,7 @@ sfi_pspec_get_choice_values (GParamSpec *pspec)
SfiParamSpecChoice *cspec;
SfiChoiceValues dummy = { 0, };
- g_return_val_if_fail (SFI_IS_PSPEC_CHOICE (pspec), dummy);
+ assert_return (SFI_IS_PSPEC_CHOICE (pspec), dummy);
cspec = SFI_PSPEC_CHOICE (pspec);
return cspec->cvalues;
@@ -1275,7 +1275,7 @@ sfi_pspec_get_choice_hash (GParamSpec *pspec)
SfiParamSpecChoice *cspec;
guint64 hash;
guint i;
- g_return_val_if_fail (SFI_IS_PSPEC_CHOICE (pspec), 0);
+ assert_return (SFI_IS_PSPEC_CHOICE (pspec), 0);
cspec = SFI_PSPEC_CHOICE (pspec);
/* choices are not registered with the type system,
* so have no unique identifier. for some purposes
@@ -1293,7 +1293,7 @@ sfi_pspec_get_seq_element (GParamSpec *pspec)
{
SfiParamSpecSeq *sspec;
- g_return_val_if_fail (SFI_IS_PSPEC_SEQ (pspec), NULL);
+ assert_return (SFI_IS_PSPEC_SEQ (pspec), NULL);
sspec = SFI_PSPEC_SEQ (pspec);
return sspec->element;
@@ -1305,7 +1305,7 @@ sfi_pspec_get_rec_fields (GParamSpec *pspec)
SfiParamSpecRec *rspec;
SfiRecFields dummy = { 0, };
- g_return_val_if_fail (SFI_IS_PSPEC_REC (pspec), dummy);
+ assert_return (SFI_IS_PSPEC_REC (pspec), dummy);
rspec = SFI_PSPEC_REC (pspec);
return rspec->fields;
@@ -1318,7 +1318,7 @@ sfi_pspec_get_rec_field (GParamSpec *pspec,
SfiParamSpecRec *rspec;
guint i;
- g_return_val_if_fail (SFI_IS_PSPEC_REC (pspec), NULL);
+ assert_return (SFI_IS_PSPEC_REC (pspec), NULL);
rspec = SFI_PSPEC_REC (pspec);
for (i = 0; i < rspec->fields.n_fields; i++)
@@ -1415,7 +1415,7 @@ sfi_categorize_pspec (GParamSpec *pspec)
GType value_type, pspec_type;
SfiSCategory cat;
- g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), SFI_SCAT_INVAL);
+ assert_return (G_IS_PARAM_SPEC (pspec), SFI_SCAT_INVAL);
value_type = G_PARAM_SPEC_VALUE_TYPE (pspec);
pspec_type = G_PARAM_SPEC_TYPE (pspec);
@@ -1469,7 +1469,7 @@ sfi_pspec_to_rec (GParamSpec *pspec)
SfiRec *prec;
const gchar *string;
- g_return_val_if_fail (pspec != NULL, NULL);
+ assert_return (pspec != NULL, NULL);
scat = sfi_categorize_pspec (pspec);
if (!scat)
@@ -1586,7 +1586,7 @@ sfi_pspec_from_rec (SfiRec *prec)
SfiRecFields zero_rfields = { 0, 0, };
GType ptype;
- g_return_val_if_fail (prec != NULL, NULL);
+ assert_return (prec != NULL, NULL);
SfiSCategory scat = (SfiSCategory) sfi_rec_get_int (prec, "sfi_scategory");
name = sfi_rec_get_string (prec, "name");
diff --git a/sfi/sfiprimitives.cc b/sfi/sfiprimitives.cc
index d92deba..5504014 100644
--- a/sfi/sfiprimitives.cc
+++ b/sfi/sfiprimitives.cc
@@ -29,8 +29,8 @@ sfi_bblock_new_sized (guint size)
SfiBBlock*
sfi_bblock_ref (SfiBBlock *bblock)
{
- g_return_val_if_fail (bblock != NULL, NULL);
- g_return_val_if_fail (bblock->ref_count > 0, NULL);
+ assert_return (bblock != NULL, NULL);
+ assert_return (bblock->ref_count > 0, NULL);
bblock->ref_count++;
return bblock;
@@ -39,8 +39,8 @@ sfi_bblock_ref (SfiBBlock *bblock)
void
sfi_bblock_unref (SfiBBlock *bblock)
{
- g_return_if_fail (bblock != NULL);
- g_return_if_fail (bblock->ref_count > 0);
+ assert_return (bblock != NULL);
+ assert_return (bblock->ref_count > 0);
bblock->ref_count--;
if (bblock->ref_count == 0)
@@ -56,7 +56,7 @@ sfi_bblock_resize (SfiBBlock *bblock,
{
guint i;
- g_return_if_fail (bblock != NULL);
+ assert_return (bblock != NULL);
i = bblock->n_bytes;
bblock->n_bytes = size;
@@ -70,8 +70,8 @@ sfi_bblock_copy_deep (const SfiBBlock *bblock)
{
SfiBBlock *fb;
- g_return_val_if_fail (bblock != NULL, NULL);
- g_return_val_if_fail (bblock->ref_count > 0, NULL);
+ assert_return (bblock != NULL, NULL);
+ assert_return (bblock->ref_count > 0, NULL);
fb = sfi_bblock_new ();
fb->n_bytes = bblock->n_bytes;
@@ -84,13 +84,13 @@ sfi_bblock_append (SfiBBlock *bblock,
guint n_bytes,
const guint8 *bytes)
{
- g_return_if_fail (bblock != NULL);
+ assert_return (bblock != NULL);
if (n_bytes)
{
guint i;
- g_return_if_fail (bytes != NULL);
+ assert_return (bytes != NULL);
i = bblock->n_bytes;
bblock->n_bytes += n_bytes;
@@ -105,7 +105,7 @@ sfi_bblock_append1 (SfiBBlock *bblock,
{
guint i;
- g_return_if_fail (bblock != NULL);
+ assert_return (bblock != NULL);
i = bblock->n_bytes++;
bblock->bytes = g_renew (guint8, bblock->bytes, bblock->n_bytes);
@@ -115,14 +115,14 @@ sfi_bblock_append1 (SfiBBlock *bblock,
guint
sfi_bblock_length (const SfiBBlock *bblock)
{
- g_return_val_if_fail (bblock != NULL, 0);
+ assert_return (bblock != NULL, 0);
return bblock->n_bytes;
}
guint8*
sfi_bblock_get (const SfiBBlock *bblock)
{
- g_return_val_if_fail (bblock != NULL, NULL);
+ assert_return (bblock != NULL, NULL);
return bblock->bytes;
}
@@ -152,7 +152,7 @@ sfi_fblock_new_foreign (guint n_values,
gfloat *values,
GFreeFunc freefunc)
{
- g_return_val_if_fail (n_values == 0 || values != NULL, NULL);
+ assert_return (n_values == 0 || values != NULL, NULL);
SfiFBlock *fblock = sfi_fblock_new ();
fblock->n_values = n_values;
fblock->values = values;
@@ -163,8 +163,8 @@ sfi_fblock_new_foreign (guint n_values,
SfiFBlock*
sfi_fblock_ref (SfiFBlock *fblock)
{
- g_return_val_if_fail (fblock != NULL, NULL);
- g_return_val_if_fail (fblock->ref_count > 0, NULL);
+ assert_return (fblock != NULL, NULL);
+ assert_return (fblock->ref_count > 0, NULL);
fblock->ref_count++;
return fblock;
@@ -173,8 +173,8 @@ sfi_fblock_ref (SfiFBlock *fblock)
void
sfi_fblock_unref (SfiFBlock *fblock)
{
- g_return_if_fail (fblock != NULL);
- g_return_if_fail (fblock->ref_count > 0);
+ assert_return (fblock != NULL);
+ assert_return (fblock->ref_count > 0);
fblock->ref_count--;
if (fblock->ref_count == 0)
@@ -206,7 +206,7 @@ void
sfi_fblock_resize (SfiFBlock *fblock,
guint size)
{
- g_return_if_fail (fblock != NULL);
+ assert_return (fblock != NULL);
guint osize = fblock->n_values;
fblock_resize (fblock, size);
@@ -219,8 +219,8 @@ sfi_fblock_copy_deep (const SfiFBlock *fblock)
{
SfiFBlock *fb;
- g_return_val_if_fail (fblock != NULL, NULL);
- g_return_val_if_fail (fblock->ref_count > 0, NULL);
+ assert_return (fblock != NULL, NULL);
+ assert_return (fblock->ref_count > 0, NULL);
fb = sfi_fblock_new ();
fb->n_values = fblock->n_values;
@@ -233,11 +233,11 @@ sfi_fblock_append (SfiFBlock *fblock,
guint n_values,
const gfloat *values)
{
- g_return_if_fail (fblock != NULL);
+ assert_return (fblock != NULL);
if (n_values)
{
- g_return_if_fail (values != NULL);
+ assert_return (values != NULL);
guint oldsize = fblock->n_values;
fblock_resize (fblock, oldsize + n_values);
memcpy (fblock->values + oldsize, values, n_values * sizeof (fblock->values[0]));
@@ -248,7 +248,7 @@ void
sfi_fblock_append1 (SfiFBlock *fblock,
gfloat float0)
{
- g_return_if_fail (fblock != NULL);
+ assert_return (fblock != NULL);
fblock_resize (fblock, fblock->n_values + 1);
fblock->values[fblock->n_values - 1] = float0;
}
@@ -256,14 +256,14 @@ sfi_fblock_append1 (SfiFBlock *fblock,
guint
sfi_fblock_length (const SfiFBlock *fblock)
{
- g_return_val_if_fail (fblock != NULL, 0);
+ assert_return (fblock != NULL, 0);
return fblock->n_values;
}
gfloat*
sfi_fblock_get (const SfiFBlock *fblock)
{
- g_return_val_if_fail (fblock != NULL, NULL);
+ assert_return (fblock != NULL, NULL);
return fblock->values;
}
@@ -284,8 +284,8 @@ sfi_seq_new (void)
SfiSeq*
sfi_seq_ref (SfiSeq *seq)
{
- g_return_val_if_fail (seq != NULL, NULL);
- g_return_val_if_fail (seq->ref_count > 0, NULL);
+ assert_return (seq != NULL, NULL);
+ assert_return (seq->ref_count > 0, NULL);
seq->ref_count++;
return seq;
@@ -294,8 +294,8 @@ sfi_seq_ref (SfiSeq *seq)
void
sfi_seq_clear (SfiSeq *seq)
{
- g_return_if_fail (seq != NULL);
- g_return_if_fail (seq->ref_count > 0);
+ assert_return (seq != NULL);
+ assert_return (seq->ref_count > 0);
while (seq->n_elements)
g_value_unset (seq->elements + --seq->n_elements);
@@ -306,8 +306,8 @@ sfi_seq_clear (SfiSeq *seq)
void
sfi_seq_unref (SfiSeq *seq)
{
- g_return_if_fail (seq != NULL);
- g_return_if_fail (seq->ref_count > 0);
+ assert_return (seq != NULL);
+ assert_return (seq->ref_count > 0);
seq->ref_count--;
if (seq->ref_count == 0)
@@ -333,7 +333,7 @@ sfi_seq_append_copy (SfiSeq *seq,
{
guint i, l, n;
- g_return_if_fail (seq != NULL);
+ assert_return (seq != NULL);
l = upper_power2 (seq->n_elements);
i = seq->n_elements++;
@@ -356,8 +356,8 @@ sfi_seq_copy_deep (const SfiSeq *seq)
SfiSeq *s;
guint i;
- g_return_val_if_fail (seq != NULL, NULL);
- g_return_val_if_fail (seq->ref_count > 0, NULL);
+ assert_return (seq != NULL, NULL);
+ assert_return (seq->ref_count > 0, NULL);
s = sfi_seq_new ();
for (i = 0; i < seq->n_elements; i++)
@@ -369,8 +369,8 @@ void
sfi_seq_append (SfiSeq *seq,
const GValue *value)
{
- g_return_if_fail (seq != NULL);
- g_return_if_fail (G_IS_VALUE (value));
+ assert_return (seq != NULL);
+ assert_return (G_IS_VALUE (value));
sfi_seq_append_copy (seq, G_VALUE_TYPE (value), FALSE, value);
}
@@ -379,8 +379,8 @@ GValue*
sfi_seq_append_empty (SfiSeq *seq,
GType value_type)
{
- g_return_val_if_fail (seq != NULL, NULL);
- g_return_val_if_fail (G_TYPE_IS_VALUE (value_type), NULL);
+ assert_return (seq != NULL, NULL);
+ assert_return (G_TYPE_IS_VALUE (value_type), NULL);
sfi_seq_append_copy (seq, value_type, FALSE, NULL);
return seq->elements + seq->n_elements - 1;
@@ -396,8 +396,8 @@ GValue*
sfi_seq_get (const SfiSeq *seq,
guint index)
{
- g_return_val_if_fail (seq != NULL, NULL);
- g_return_val_if_fail (index < seq->n_elements, NULL);
+ assert_return (seq != NULL, NULL);
+ assert_return (index < seq->n_elements, NULL);
return seq->elements + index;
}
@@ -408,7 +408,7 @@ sfi_seq_check (SfiSeq *seq,
{
guint i;
- g_return_val_if_fail (seq != NULL, FALSE);
+ assert_return (seq != NULL, FALSE);
for (i = 0; i < seq->n_elements; i++)
if (!G_VALUE_HOLDS (seq->elements + i, element_type))
@@ -420,8 +420,8 @@ gboolean
sfi_seq_validate (SfiSeq *seq,
GParamSpec *pspec)
{
- g_return_val_if_fail (seq != NULL, FALSE);
- g_return_val_if_fail (pspec != NULL, FALSE);
+ assert_return (seq != NULL, FALSE);
+ assert_return (pspec != NULL, FALSE);
GValue *v = sfi_value_seq (seq);
gboolean changed = g_param_value_validate (pspec, v);
@@ -681,7 +681,7 @@ sfi_seq_to_strv (SfiSeq *seq)
gchar **strv;
guint i;
- g_return_val_if_fail (seq != NULL, NULL);
+ assert_return (seq != NULL, NULL);
for (i = 0; i < seq->n_elements; i++)
if (G_VALUE_HOLDS_STRING (seq->elements + i))
@@ -737,8 +737,8 @@ sfi_rec_new (void)
SfiRec*
sfi_rec_ref (SfiRec *rec)
{
- g_return_val_if_fail (rec != NULL, NULL);
- g_return_val_if_fail (rec->ref_count > 0, NULL);
+ assert_return (rec != NULL, NULL);
+ assert_return (rec->ref_count > 0, NULL);
rec->ref_count++;
@@ -766,8 +766,8 @@ sfi_rec_empty (SfiRec *rec)
void
sfi_rec_unref (SfiRec *rec)
{
- g_return_if_fail (rec != NULL);
- g_return_if_fail (rec->ref_count > 0);
+ assert_return (rec != NULL);
+ assert_return (rec->ref_count > 0);
rec->ref_count--;
if (rec->ref_count == 0)
@@ -780,8 +780,8 @@ sfi_rec_unref (SfiRec *rec)
void
sfi_rec_clear (SfiRec *rec)
{
- g_return_if_fail (rec != NULL);
- g_return_if_fail (rec->ref_count > 0);
+ assert_return (rec != NULL);
+ assert_return (rec->ref_count > 0);
sfi_rec_empty (rec);
}
@@ -789,7 +789,7 @@ sfi_rec_clear (SfiRec *rec)
guint
sfi_rec_n_fields (const SfiRec *rec)
{
- g_return_val_if_fail (rec != NULL, 0);
+ assert_return (rec != NULL, 0);
return rec ? rec->n_fields : 0;
}
@@ -797,8 +797,8 @@ GValue*
sfi_rec_field (const SfiRec *rec,
guint index)
{
- g_return_val_if_fail (rec != NULL, NULL);
- g_return_val_if_fail (index < rec->n_fields, NULL);
+ assert_return (rec != NULL, NULL);
+ assert_return (index < rec->n_fields, NULL);
return rec->fields + index;
}
@@ -906,9 +906,9 @@ sfi_rec_set (SfiRec *rec,
const gchar *field_name,
const GValue *value)
{
- g_return_if_fail (rec != NULL);
- g_return_if_fail (field_name != NULL);
- g_return_if_fail (SFI_IS_VALUE (value));
+ assert_return (rec != NULL);
+ assert_return (field_name != NULL);
+ assert_return (SFI_IS_VALUE (value));
sfi_rec_set_copy (rec, field_name, G_VALUE_TYPE (value), FALSE, value);
}
@@ -921,8 +921,8 @@ sfi_rec_get (SfiRec *rec,
gchar *dupcanon_name;
guint i;
- g_return_val_if_fail (rec != NULL, NULL);
- g_return_val_if_fail (field_name != NULL, NULL);
+ assert_return (rec != NULL, NULL);
+ assert_return (field_name != NULL, NULL);
if (!rec->sorted)
sfi_rec_sort (rec);
@@ -943,9 +943,9 @@ sfi_rec_forced_get (SfiRec *rec,
const gchar *name;
gchar *dupcanon_name;
guint i;
- g_return_val_if_fail (rec != NULL, NULL);
- g_return_val_if_fail (field_name != NULL, NULL);
- g_return_val_if_fail (G_TYPE_IS_VALUE (value_type), NULL);
+ assert_return (rec != NULL, NULL);
+ assert_return (field_name != NULL, NULL);
+ assert_return (G_TYPE_IS_VALUE (value_type), NULL);
if (!rec->sorted)
sfi_rec_sort (rec);
dupcanon_name = may_dupcanon (field_name);
@@ -975,8 +975,8 @@ sfi_rec_copy_deep (SfiRec *rec)
SfiRec *r;
guint i;
- g_return_val_if_fail (rec != NULL, NULL);
- g_return_val_if_fail (rec->ref_count > 0, NULL);
+ assert_return (rec != NULL, NULL);
+ assert_return (rec->ref_count > 0, NULL);
sfi_rec_sort (rec);
r = sfi_rec_new ();
@@ -992,8 +992,8 @@ sfi_rec_check (SfiRec *rec,
{
guint i;
- g_return_val_if_fail (rec != NULL, FALSE);
- g_return_val_if_fail (rfields.n_fields > 0, FALSE);
+ assert_return (rec != NULL, FALSE);
+ assert_return (rfields.n_fields > 0, FALSE);
if (!rec->sorted)
sfi_rec_sort (rec);
@@ -1019,7 +1019,7 @@ strpointercmp (const void *p1,
void
sfi_rec_sort (SfiRec *rec)
{
- g_return_if_fail (rec != NULL);
+ assert_return (rec != NULL);
if (!rec->sorted && rec->n_fields > 1)
{
@@ -1054,8 +1054,8 @@ sfi_rec_swap_fields (SfiRec *rec,
GValue *fields;
gchar **names;
- g_return_if_fail (rec != NULL);
- g_return_if_fail (swapper != NULL);
+ assert_return (rec != NULL);
+ assert_return (swapper != NULL);
sfi_rec_sort (rec);
sfi_rec_sort (swapper);
@@ -1078,7 +1078,7 @@ sfi_rec_validate (SfiRec *rec,
GValue *v;
gboolean changed;
- g_return_val_if_fail (rec != NULL, FALSE);
+ assert_return (rec != NULL, FALSE);
pspec = sfi_pspec_rec ("auto", NULL, NULL, fields, ":readwrite");
v = sfi_value_rec (rec);
diff --git a/sfi/sfiring.cc b/sfi/sfiring.cc
index 8cc8737..7ba241f 100644
--- a/sfi/sfiring.cc
+++ b/sfi/sfiring.cc
@@ -245,9 +245,9 @@ sfi_ring_split (SfiRing *head1,
{
SfiRing *tail1, *tail2;
- g_return_val_if_fail (head1 != NULL, NULL);
- g_return_val_if_fail (head2 != NULL, NULL);
- g_return_val_if_fail (head1 != head2, NULL);
+ assert_return (head1 != NULL, NULL);
+ assert_return (head2 != NULL, NULL);
+ assert_return (head1 != head2, NULL);
tail1 = head2->prev;
tail2 = head1->prev;
@@ -280,19 +280,19 @@ sfi_ring_remove_node (SfiRing *head,
SfiRing *node)
{
if (!head)
- g_return_val_if_fail (head == NULL && node == NULL, NULL);
+ assert_return (head == NULL && node == NULL, NULL);
if (!head || !node)
return NULL;
/* special case one item ring */
if (head->prev == head)
{
- g_return_val_if_fail (node == head, head);
+ assert_return (node == head, head);
node_free (node);
return NULL;
}
- g_return_val_if_fail (node != node->next, head); /* node can't be a one item ring here */
+ assert_return (node != node->next, head); /* node can't be a one item ring here */
node->next->prev = node->prev;
node->prev->next = node->next;
@@ -428,7 +428,7 @@ sfi_ring_pop_head (SfiRing **head_p)
{
gpointer data;
- g_return_val_if_fail (head_p != NULL, NULL);
+ assert_return (head_p != NULL, NULL);
if (!*head_p)
return NULL;
@@ -443,7 +443,7 @@ sfi_ring_pop_tail (SfiRing **head_p)
{
gpointer data;
- g_return_val_if_fail (head_p != NULL, NULL);
+ assert_return (head_p != NULL, NULL);
if (!*head_p)
return NULL;
@@ -499,7 +499,7 @@ sfi_ring_insert_sorted (SfiRing *head,
SfiCompareFunc cmp,
gpointer cmp_data)
{
- g_return_val_if_fail (cmp != NULL, head);
+ assert_return (cmp != NULL, head);
if (!head)
return sfi_ring_prepend (head, insertion_data);
@@ -581,7 +581,7 @@ sfi_ring_sort (SfiRing *head,
SfiCompareFunc cmp,
gpointer data)
{
- g_return_val_if_fail (cmp != NULL, head);
+ assert_return (cmp != NULL, head);
/* stable sorting guaranteed by sfi_ring_merge_sorted() */
diff --git a/sfi/sfiserial.cc b/sfi/sfiserial.cc
index c2779bd..156fc93 100644
--- a/sfi/sfiserial.cc
+++ b/sfi/sfiserial.cc
@@ -580,8 +580,8 @@ sfi_value_store_typed (const GValue *value,
{
SfiSCategory scat;
- g_return_if_fail (G_IS_VALUE (value));
- g_return_if_fail (gstring != NULL);
+ assert_return (G_IS_VALUE (value));
+ assert_return (gstring != NULL);
scat = SfiSCategory (sfi_categorize_type (G_VALUE_TYPE (value)) & SFI_SCAT_TYPE_MASK);
switch (scat)
@@ -638,8 +638,8 @@ GTokenType
sfi_value_parse_typed (GValue *value,
GScanner *scanner)
{
- g_return_val_if_fail (value != NULL && G_VALUE_TYPE (value) == 0, G_TOKEN_ERROR);
- g_return_val_if_fail (scanner != NULL, G_TOKEN_ERROR);
+ assert_return (value != NULL && G_VALUE_TYPE (value) == 0, G_TOKEN_ERROR);
+ assert_return (scanner != NULL, G_TOKEN_ERROR);
parse_or_return (scanner, '(');
char scat = g_scanner_get_next_token (scanner);
@@ -817,10 +817,10 @@ sfi_value_store_param (const GValue *value,
{
gboolean needs_break = FALSE;
- g_return_if_fail (G_IS_VALUE (value));
- g_return_if_fail (gstring != NULL);
- g_return_if_fail (G_IS_PARAM_SPEC (pspec));
- g_return_if_fail (G_VALUE_HOLDS (value, G_PARAM_SPEC_VALUE_TYPE (pspec)));
+ assert_return (G_IS_VALUE (value));
+ assert_return (gstring != NULL);
+ assert_return (G_IS_PARAM_SPEC (pspec));
+ assert_return (G_VALUE_HOLDS (value, G_PARAM_SPEC_VALUE_TYPE (pspec)));
gstring_check_break (gstring, &needs_break, indent);
gstring_printf (gstring, "(%s ", pspec->name);
@@ -952,13 +952,13 @@ sfi_value_parse_param_rest (GValue *value,
GScanner *scanner,
GParamSpec *pspec)
{
- g_return_val_if_fail (value != NULL && G_VALUE_TYPE (value) == 0, G_TOKEN_ERROR);
- g_return_val_if_fail (scanner != NULL, G_TOKEN_ERROR);
- g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), G_TOKEN_ERROR);
+ assert_return (value != NULL && G_VALUE_TYPE (value) == 0, G_TOKEN_ERROR);
+ assert_return (scanner != NULL, G_TOKEN_ERROR);
+ assert_return (G_IS_PARAM_SPEC (pspec), G_TOKEN_ERROR);
/* the scanner better be at the pspec name */
- g_return_val_if_fail (scanner->token == G_TOKEN_IDENTIFIER, G_TOKEN_ERROR);
- g_return_val_if_fail (strcmp (scanner->value.v_identifier, pspec->name) == 0, G_TOKEN_ERROR);
+ assert_return (scanner->token == G_TOKEN_IDENTIFIER, G_TOKEN_ERROR);
+ assert_return (strcmp (scanner->value.v_identifier, pspec->name) == 0, G_TOKEN_ERROR);
g_value_init (value, G_PARAM_SPEC_VALUE_TYPE (pspec));
@@ -968,7 +968,7 @@ sfi_value_parse_param_rest (GValue *value,
gboolean
sfi_serial_check_parse_null_token (GScanner *scanner)
{
- g_return_val_if_fail (scanner != NULL, FALSE);
+ assert_return (scanner != NULL, FALSE);
if (scanner->token == '#' && g_scanner_peek_next_token (scanner) == 'f')
{
diff --git a/sfi/sfistore.cc b/sfi/sfistore.cc
index 9fcfcac..3b3f507 100644
--- a/sfi/sfistore.cc
+++ b/sfi/sfistore.cc
@@ -37,7 +37,7 @@ sfi_wstore_new (void)
void
sfi_wstore_destroy (SfiWStore *wstore)
{
- g_return_if_fail (wstore != NULL);
+ assert_return (wstore != NULL);
g_string_free (wstore->text, TRUE);
wstore->text = NULL;
@@ -60,7 +60,7 @@ sfi_wstore_text_changed (SfiWStore *wstore)
void
sfi_wstore_break (SfiWStore *wstore)
{
- g_return_if_fail (wstore != NULL);
+ assert_return (wstore != NULL);
if (wstore->needs_break)
{
@@ -76,7 +76,7 @@ sfi_wstore_break (SfiWStore *wstore)
void
sfi_wstore_push_level (SfiWStore *wstore)
{
- g_return_if_fail (wstore != NULL);
+ assert_return (wstore != NULL);
wstore->indent += 2;
}
@@ -84,7 +84,7 @@ sfi_wstore_push_level (SfiWStore *wstore)
void
sfi_wstore_pop_level (SfiWStore *wstore)
{
- g_return_if_fail (wstore != NULL);
+ assert_return (wstore != NULL);
if (wstore->indent >= 2)
wstore->indent -= 2;
@@ -94,7 +94,7 @@ void
sfi_wstore_puts (SfiWStore *wstore,
const gchar *string)
{
- g_return_if_fail (wstore != NULL);
+ assert_return (wstore != NULL);
if (string)
{
@@ -108,7 +108,7 @@ void
sfi_wstore_putc (SfiWStore *wstore,
gchar character)
{
- g_return_if_fail (wstore != NULL);
+ assert_return (wstore != NULL);
g_string_append_c (wstore->text, character);
sfi_wstore_text_changed (wstore);
@@ -120,7 +120,7 @@ sfi_wstore_putf (SfiWStore *wstore,
{
gchar numbuf[G_ASCII_DTOSTR_BUF_SIZE + 1] = "";
- g_return_if_fail (wstore != NULL);
+ assert_return (wstore != NULL);
g_ascii_formatd (numbuf, G_ASCII_DTOSTR_BUF_SIZE, "%.7g", vfloat);
@@ -133,7 +133,7 @@ sfi_wstore_putd (SfiWStore *wstore,
{
gchar numbuf[G_ASCII_DTOSTR_BUF_SIZE + 1] = "";
- g_return_if_fail (wstore != NULL);
+ assert_return (wstore != NULL);
g_ascii_formatd (numbuf, G_ASCII_DTOSTR_BUF_SIZE, "%.17g", vdouble);
@@ -146,8 +146,8 @@ sfi_wstore_put_value (SfiWStore *wstore,
{
GString *gstring;
- g_return_if_fail (wstore != NULL);
- g_return_if_fail (G_IS_VALUE (value));
+ assert_return (wstore != NULL);
+ assert_return (G_IS_VALUE (value));
gstring = g_string_new (NULL);
sfi_value_store_typed (value, gstring);
@@ -163,9 +163,9 @@ sfi_wstore_put_param (SfiWStore *wstore,
GValue svalue = { 0, };
GParamSpec *spspec;
- g_return_if_fail (wstore != NULL);
- g_return_if_fail (G_IS_VALUE (value));
- g_return_if_fail (G_IS_PARAM_SPEC (pspec));
+ assert_return (wstore != NULL);
+ assert_return (G_IS_VALUE (value));
+ assert_return (G_IS_PARAM_SPEC (pspec));
spspec = sfi_pspec_to_serializable (pspec);
if (!spspec) /* we really can't do anything here */
@@ -207,9 +207,9 @@ sfi_wstore_put_binary (SfiWStore *wstore,
{
BBlock *bblock;
- g_return_if_fail (wstore != NULL);
- g_return_if_fail (wstore->flushed == FALSE);
- g_return_if_fail (reader != NULL);
+ assert_return (wstore != NULL);
+ assert_return (wstore->flushed == FALSE);
+ assert_return (reader != NULL);
bblock = g_new0 (BBlock, 1);
bblock->reader = reader;
@@ -226,7 +226,7 @@ const gchar*
sfi_wstore_peek_text (SfiWStore *wstore,
guint *length_p)
{
- g_return_val_if_fail (wstore != NULL, NULL);
+ assert_return (wstore != NULL, NULL);
if (length_p)
*length_p = wstore->text->len;
@@ -244,9 +244,9 @@ sfi_wstore_flush_fd (SfiWStore *wstore,
off_t text_offset, binary_offset;
guint l;
- g_return_val_if_fail (wstore != NULL, -EINVAL);
- g_return_val_if_fail (wstore->flushed == FALSE, -EINVAL);
- g_return_val_if_fail (fd >= 0, -EINVAL);
+ assert_return (wstore != NULL, -EINVAL);
+ assert_return (wstore->flushed == FALSE, -EINVAL);
+ assert_return (fd >= 0, -EINVAL);
wstore->flushed = TRUE;
@@ -403,7 +403,7 @@ sfi_rstore_new_open (const gchar *fname)
void
sfi_rstore_destroy (SfiRStore *rstore)
{
- g_return_if_fail (rstore != NULL);
+ assert_return (rstore != NULL);
if (rstore->close_fd >= 0)
close (rstore->close_fd);
@@ -417,8 +417,8 @@ sfi_rstore_input_fd (SfiRStore *rstore,
gint fd,
const gchar *fname)
{
- g_return_if_fail (rstore != NULL);
- g_return_if_fail (fd >= 0);
+ assert_return (rstore != NULL);
+ assert_return (fd >= 0);
g_free (rstore->fname);
rstore->fname = g_strdup (fname ? fname : "<anon-fd>");
@@ -432,8 +432,8 @@ sfi_rstore_input_text (SfiRStore *rstore,
const gchar *text,
const gchar *text_name)
{
- g_return_if_fail (rstore != NULL);
- g_return_if_fail (text != NULL);
+ assert_return (rstore != NULL);
+ assert_return (text != NULL);
g_free (rstore->fname);
rstore->fname = g_strdup (text_name ? text_name : "<memory>");
@@ -447,7 +447,7 @@ sfi_rstore_eof (SfiRStore *rstore)
{
GScanner *scanner;
- g_return_val_if_fail (rstore != NULL, TRUE);
+ assert_return (rstore != NULL, TRUE);
scanner = rstore->scanner;
@@ -457,7 +457,7 @@ sfi_rstore_eof (SfiRStore *rstore)
void
sfi_rstore_error (SfiRStore *rstore, const std::string &msg)
{
- g_return_if_fail (rstore);
+ assert_return (rstore);
if (rstore->scanner->parse_errors < rstore->scanner->max_parse_errors)
g_scanner_error (rstore->scanner, "%s", msg.c_str());
@@ -469,7 +469,7 @@ sfi_rstore_unexp_token (SfiRStore *rstore,
{
GScanner *scanner;
- g_return_if_fail (rstore);
+ assert_return (rstore);
scanner = rstore->scanner;
if (scanner->parse_errors < scanner->max_parse_errors)
@@ -487,7 +487,7 @@ sfi_rstore_unexp_token (SfiRStore *rstore,
void
sfi_rstore_warn (SfiRStore *rstore, const std::string &msg)
{
- g_return_if_fail (rstore);
+ assert_return (rstore);
if (rstore->scanner->parse_errors < rstore->scanner->max_parse_errors)
g_scanner_warn (rstore->scanner, "%s", msg.c_str());
@@ -497,8 +497,8 @@ static GTokenType
scanner_skip_statement (GScanner *scanner,
guint level) /* == number of closing parens left to read */
{
- g_return_val_if_fail (scanner != NULL, G_TOKEN_ERROR);
- g_return_val_if_fail (level > 0, G_TOKEN_ERROR);
+ assert_return (scanner != NULL, G_TOKEN_ERROR);
+ assert_return (level > 0, G_TOKEN_ERROR);
do
{
@@ -525,7 +525,7 @@ scanner_skip_statement (GScanner *scanner,
GTokenType
sfi_rstore_warn_skip (SfiRStore *rstore, const std::string &msg)
{
- g_return_val_if_fail (rstore, G_TOKEN_ERROR);
+ assert_return (rstore, G_TOKEN_ERROR);
if (rstore->scanner->parse_errors < rstore->scanner->max_parse_errors)
/* construct warning *before* modifying scanner state */
@@ -540,7 +540,7 @@ sfi_rstore_quick_scan (SfiRStore *rstore,
SfiRStoreQuickScan qcheck,
gpointer data)
{
- g_return_if_fail (rstore);
+ assert_return (rstore);
while (g_scanner_peek_next_token (rstore->scanner) == '(')
{
@@ -567,9 +567,9 @@ sfi_rstore_parse_param (SfiRStore *rstore,
GValue pvalue = { 0, };
GTokenType token;
- g_return_val_if_fail (rstore != NULL, G_TOKEN_ERROR);
- g_return_val_if_fail (G_IS_VALUE (value), G_TOKEN_ERROR);
- g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), G_TOKEN_ERROR);
+ assert_return (rstore != NULL, G_TOKEN_ERROR);
+ assert_return (G_IS_VALUE (value), G_TOKEN_ERROR);
+ assert_return (G_IS_PARAM_SPEC (pspec), G_TOKEN_ERROR);
spspec = sfi_pspec_to_serializable (pspec);
if (!spspec) /* we really can't do anything here */
@@ -659,7 +659,7 @@ rstore_ensure_bin_offset (SfiRStore *rstore)
GTokenType
sfi_rstore_ensure_bin_offset (SfiRStore *rstore)
{
- g_return_val_if_fail (rstore != NULL, G_TOKEN_ERROR);
+ assert_return (rstore != NULL, G_TOKEN_ERROR);
if (!rstore_ensure_bin_offset (rstore))
{
@@ -675,8 +675,8 @@ sfi_rstore_ensure_bin_offset (SfiRStore *rstore)
guint64
sfi_rstore_get_bin_offset (SfiRStore *rstore)
{
- g_return_val_if_fail (rstore != NULL, 0);
- g_return_val_if_fail (rstore->bin_offset >= 0, 0); /* sfi_rstore_ensure_bin_offset() must be called
before hand */
+ assert_return (rstore != NULL, 0);
+ assert_return (rstore->bin_offset >= 0, 0); /* sfi_rstore_ensure_bin_offset() must be called before
hand */
return rstore->bin_offset;
}
@@ -686,8 +686,8 @@ sfi_rstore_parse_zbinary (SfiRStore *rstore,
SfiNum *offset_p,
SfiNum *length_p)
{
- g_return_val_if_fail (rstore != NULL, G_TOKEN_ERROR);
- g_return_val_if_fail (offset_p && length_p, G_TOKEN_ERROR);
+ assert_return (rstore != NULL, G_TOKEN_ERROR);
+ assert_return (offset_p && length_p, G_TOKEN_ERROR);
if (g_scanner_get_next_token (rstore->scanner) != '(')
return GTokenType ('(');
@@ -731,9 +731,9 @@ sfi_rstore_parse_until (SfiRStore *rstore,
{
GScanner *scanner;
- g_return_val_if_fail (rstore != NULL, G_TOKEN_ERROR);
- g_return_val_if_fail (try_statement != NULL, G_TOKEN_ERROR);
- g_return_val_if_fail (closing_token == G_TOKEN_EOF || closing_token == ')', G_TOKEN_ERROR);
+ assert_return (rstore != NULL, G_TOKEN_ERROR);
+ assert_return (try_statement != NULL, G_TOKEN_ERROR);
+ assert_return (closing_token == G_TOKEN_EOF || closing_token == ')', G_TOKEN_ERROR);
scanner = rstore->scanner;
@@ -787,8 +787,8 @@ sfi_rstore_parse_all (SfiRStore *rstore,
{
GTokenType expected_token = G_TOKEN_NONE;
- g_return_val_if_fail (rstore != NULL, 1);
- g_return_val_if_fail (try_statement != NULL, 1);
+ assert_return (rstore != NULL, 1);
+ assert_return (try_statement != NULL, 1);
/* parse all statements */
expected_token = sfi_rstore_parse_until (rstore, G_TOKEN_EOF, context_data, try_statement, user_data);
diff --git a/sfi/sfitime.cc b/sfi/sfitime.cc
index bb5a953..7c583d9 100644
--- a/sfi/sfitime.cc
+++ b/sfi/sfitime.cc
@@ -237,7 +237,7 @@ sfi_time_from_string_err (const gchar *time_string,
SfiRing *ring, *warnings = NULL;
guint i;
- g_return_val_if_fail (time_string != NULL, 0);
+ assert_return (time_string != NULL, 0);
/* here, we support several date formats by making several attempts
* to match a string and pick the best one. if we acquire a full match
diff --git a/sfi/sfitypes.cc b/sfi/sfitypes.cc
index fef6926..12bdb7d 100644
--- a/sfi/sfitypes.cc
+++ b/sfi/sfitypes.cc
@@ -64,8 +64,8 @@ sfi_choice_match_detailed (const gchar *choice_val1,
const gchar *choice_val2,
gboolean l1_ge_l2)
{
- g_return_val_if_fail (choice_val1 != NULL, FALSE);
- g_return_val_if_fail (choice_val2 != NULL, FALSE);
+ assert_return (choice_val1 != NULL, FALSE);
+ assert_return (choice_val2 != NULL, FALSE);
guint l1 = strlen (choice_val1);
guint l2 = strlen (choice_val2);
@@ -122,7 +122,7 @@ sfi_constants_get_index (guint n_consts,
gchar *key;
gint i, cmp;
- g_return_val_if_fail (constant != NULL, 0);
+ assert_return (constant != NULL, 0);
/* canonicalize key */
l = strlen (constant);
@@ -186,8 +186,8 @@ sfi_constants_rcmp (const gchar *canon_identifier1,
{
gint cmp, l1, l2;
- g_return_val_if_fail (canon_identifier1 != NULL, 0);
- g_return_val_if_fail (canon_identifier2 != NULL, 0);
+ assert_return (canon_identifier1 != NULL, 0);
+ assert_return (canon_identifier2 != NULL, 0);
l1 = strlen (canon_identifier1);
l2 = strlen (canon_identifier2);
diff --git a/sfi/sfiustore.cc b/sfi/sfiustore.cc
index c6629af..5c7d736 100644
--- a/sfi/sfiustore.cc
+++ b/sfi/sfiustore.cc
@@ -37,7 +37,7 @@ gpointer
sfi_ustore_lookup (SfiUStore *store,
gulong unique_id)
{
- g_return_val_if_fail (store != NULL, NULL);
+ assert_return (store != NULL, NULL);
return g_tree_lookup (tcast (store), (gpointer) unique_id);
}
@@ -47,7 +47,7 @@ sfi_ustore_insert (SfiUStore *store,
gulong unique_id,
gpointer value)
{
- g_return_if_fail (store != NULL);
+ assert_return (store != NULL);
if (!value)
g_tree_remove (tcast (store), (gpointer) unique_id);
@@ -59,7 +59,7 @@ void
sfi_ustore_remove (SfiUStore *store,
gulong unique_id)
{
- g_return_if_fail (store != NULL);
+ assert_return (store != NULL);
g_tree_remove (tcast (store), (gpointer) unique_id);
}
@@ -86,7 +86,7 @@ sfi_ustore_foreach (SfiUStore *store,
{
FData fdata;
- g_return_if_fail (store != NULL);
+ assert_return (store != NULL);
fdata.data = data;
fdata.foreach = foreach;
@@ -96,7 +96,7 @@ sfi_ustore_foreach (SfiUStore *store,
void
sfi_ustore_destroy (SfiUStore *store)
{
- g_return_if_fail (store != NULL);
+ assert_return (store != NULL);
g_tree_destroy (tcast (store));
}
@@ -224,7 +224,7 @@ gboolean
sfi_ppool_lookup (SfiPPool *pool,
gpointer unique_ptr)
{
- g_return_val_if_fail (pool != NULL, FALSE);
+ assert_return (pool != NULL, FALSE);
return g_tree_lookup (ppool_tree (pool), unique_ptr) != NULL;
}
@@ -232,7 +232,7 @@ void
sfi_ppool_set (SfiPPool *pool,
gpointer unique_ptr)
{
- g_return_if_fail (pool != NULL);
+ assert_return (pool != NULL);
g_tree_insert (ppool_tree (pool), unique_ptr, PPOOL_TAG);
}
@@ -240,7 +240,7 @@ void
sfi_ppool_unset (SfiPPool *pool,
gpointer unique_ptr)
{
- g_return_if_fail (pool != NULL);
+ assert_return (pool != NULL);
g_tree_remove (ppool_tree (pool), unique_ptr);
}
@@ -265,7 +265,7 @@ sfi_ppool_foreach (SfiPPool *pool,
gpointer data)
{
PPoolData pdata;
- g_return_if_fail (pool != NULL);
+ assert_return (pool != NULL);
pdata.data = data;
pdata.foreach = foreach;
g_tree_foreach (ppool_tree (pool), ppool_foreach_wrapper, &pdata);
@@ -285,7 +285,7 @@ GSList*
sfi_ppool_slist (SfiPPool *pool)
{
GSList *slist = NULL;
- g_return_val_if_fail (pool != NULL, NULL);
+ assert_return (pool != NULL, NULL);
g_tree_foreach (ppool_tree (pool), ppool_foreach_slist, &slist);
return slist;
}
@@ -293,6 +293,6 @@ sfi_ppool_slist (SfiPPool *pool)
void
sfi_ppool_destroy (SfiPPool *pool)
{
- g_return_if_fail (pool != NULL);
+ assert_return (pool != NULL);
g_tree_destroy (ppool_tree (pool));
}
diff --git a/sfi/sfivalues.cc b/sfi/sfivalues.cc
index 33eae24..3db27cf 100644
--- a/sfi/sfivalues.cc
+++ b/sfi/sfivalues.cc
@@ -138,7 +138,7 @@ sfi_check_value (const GValue *value)
const char*
sfi_value_get_choice (const GValue *value)
{
- g_return_val_if_fail (SFI_VALUE_HOLDS_CHOICE (value), NULL);
+ assert_return (SFI_VALUE_HOLDS_CHOICE (value), NULL);
return g_value_get_string (value);
}
@@ -147,7 +147,7 @@ void
sfi_value_set_choice (GValue *value,
const gchar *choice_value)
{
- g_return_if_fail (SFI_VALUE_HOLDS_CHOICE (value));
+ assert_return (SFI_VALUE_HOLDS_CHOICE (value));
g_value_set_string (value, choice_value);
}
@@ -155,7 +155,7 @@ sfi_value_set_choice (GValue *value,
SfiBBlock*
sfi_value_get_bblock (const GValue *value)
{
- g_return_val_if_fail (SFI_VALUE_HOLDS_BBLOCK (value), NULL);
+ assert_return (SFI_VALUE_HOLDS_BBLOCK (value), NULL);
return (SfiBBlock*) g_value_get_boxed (value);
}
@@ -163,7 +163,7 @@ sfi_value_get_bblock (const GValue *value)
SfiBBlock*
sfi_value_dup_bblock (const GValue *value)
{
- g_return_val_if_fail (SFI_VALUE_HOLDS_BBLOCK (value), NULL);
+ assert_return (SFI_VALUE_HOLDS_BBLOCK (value), NULL);
SfiBBlock *bblock = (SfiBBlock*) g_value_get_boxed (value);
return bblock ? sfi_bblock_ref (bblock) : NULL;
@@ -173,7 +173,7 @@ void
sfi_value_set_bblock (GValue *value,
SfiBBlock *bblock)
{
- g_return_if_fail (SFI_VALUE_HOLDS_BBLOCK (value));
+ assert_return (SFI_VALUE_HOLDS_BBLOCK (value));
g_value_set_boxed (value, bblock);
}
@@ -182,7 +182,7 @@ void
sfi_value_take_bblock (GValue *value,
SfiBBlock *bblock)
{
- g_return_if_fail (SFI_VALUE_HOLDS_BBLOCK (value));
+ assert_return (SFI_VALUE_HOLDS_BBLOCK (value));
g_value_take_boxed (value, bblock);
}
@@ -190,7 +190,7 @@ sfi_value_take_bblock (GValue *value,
SfiFBlock*
sfi_value_get_fblock (const GValue *value)
{
- g_return_val_if_fail (SFI_VALUE_HOLDS_FBLOCK (value), NULL);
+ assert_return (SFI_VALUE_HOLDS_FBLOCK (value), NULL);
return (SfiFBlock*) g_value_get_boxed (value);
}
@@ -198,7 +198,7 @@ sfi_value_get_fblock (const GValue *value)
SfiFBlock*
sfi_value_dup_fblock (const GValue *value)
{
- g_return_val_if_fail (SFI_VALUE_HOLDS_FBLOCK (value), NULL);
+ assert_return (SFI_VALUE_HOLDS_FBLOCK (value), NULL);
SfiFBlock *fblock = (SfiFBlock*) g_value_get_boxed (value);
return fblock ? sfi_fblock_ref (fblock) : NULL;
@@ -208,7 +208,7 @@ void
sfi_value_set_fblock (GValue *value,
SfiFBlock *fblock)
{
- g_return_if_fail (SFI_VALUE_HOLDS_FBLOCK (value));
+ assert_return (SFI_VALUE_HOLDS_FBLOCK (value));
g_value_set_boxed (value, fblock);
}
@@ -217,7 +217,7 @@ void
sfi_value_take_fblock (GValue *value,
SfiFBlock *fblock)
{
- g_return_if_fail (SFI_VALUE_HOLDS_FBLOCK (value));
+ assert_return (SFI_VALUE_HOLDS_FBLOCK (value));
g_value_take_boxed (value, fblock);
}
@@ -225,7 +225,7 @@ sfi_value_take_fblock (GValue *value,
GParamSpec*
sfi_value_get_pspec (const GValue *value)
{
- g_return_val_if_fail (SFI_VALUE_HOLDS_PSPEC (value), NULL);
+ assert_return (SFI_VALUE_HOLDS_PSPEC (value), NULL);
return g_value_get_param (value);
}
@@ -235,7 +235,7 @@ sfi_value_dup_pspec (const GValue *value)
{
GParamSpec *pspec;
- g_return_val_if_fail (SFI_VALUE_HOLDS_PSPEC (value), NULL);
+ assert_return (SFI_VALUE_HOLDS_PSPEC (value), NULL);
pspec = g_value_get_param (value);
return pspec ? sfi_pspec_ref (pspec) : NULL;
@@ -245,7 +245,7 @@ void
sfi_value_set_pspec (GValue *value,
GParamSpec *pspec)
{
- g_return_if_fail (SFI_VALUE_HOLDS_PSPEC (value));
+ assert_return (SFI_VALUE_HOLDS_PSPEC (value));
g_value_set_param (value, pspec);
}
@@ -254,7 +254,7 @@ void
sfi_value_take_pspec (GValue *value,
GParamSpec *pspec)
{
- g_return_if_fail (SFI_VALUE_HOLDS_PSPEC (value));
+ assert_return (SFI_VALUE_HOLDS_PSPEC (value));
g_value_take_param (value, pspec);
}
@@ -262,7 +262,7 @@ sfi_value_take_pspec (GValue *value,
SfiSeq*
sfi_value_get_seq (const GValue *value)
{
- g_return_val_if_fail (SFI_VALUE_HOLDS_SEQ (value), NULL);
+ assert_return (SFI_VALUE_HOLDS_SEQ (value), NULL);
return (SfiSeq*) g_value_get_boxed (value);
}
@@ -271,7 +271,7 @@ void
sfi_value_set_seq (GValue *value,
SfiSeq *seq)
{
- g_return_if_fail (SFI_VALUE_HOLDS_SEQ (value));
+ assert_return (SFI_VALUE_HOLDS_SEQ (value));
g_value_set_boxed (value, seq);
}
@@ -280,7 +280,7 @@ void
sfi_value_take_seq (GValue *value,
SfiSeq *seq)
{
- g_return_if_fail (SFI_VALUE_HOLDS_SEQ (value));
+ assert_return (SFI_VALUE_HOLDS_SEQ (value));
g_value_take_boxed (value, seq);
}
@@ -288,7 +288,7 @@ sfi_value_take_seq (GValue *value,
SfiRec*
sfi_value_get_rec (const GValue *value)
{
- g_return_val_if_fail (SFI_VALUE_HOLDS_REC (value), NULL);
+ assert_return (SFI_VALUE_HOLDS_REC (value), NULL);
return (SfiRec*) g_value_get_boxed (value);
}
@@ -296,7 +296,7 @@ sfi_value_get_rec (const GValue *value)
SfiRec*
sfi_value_dup_rec (const GValue *value)
{
- g_return_val_if_fail (SFI_VALUE_HOLDS_REC (value), NULL);
+ assert_return (SFI_VALUE_HOLDS_REC (value), NULL);
SfiRec *rec = (SfiRec*) g_value_get_boxed (value);
return rec ? sfi_rec_ref (rec) : NULL;
}
@@ -305,7 +305,7 @@ void
sfi_value_set_rec (GValue *value,
SfiRec *rec)
{
- g_return_if_fail (SFI_VALUE_HOLDS_REC (value));
+ assert_return (SFI_VALUE_HOLDS_REC (value));
g_value_set_boxed (value, rec);
}
@@ -314,7 +314,7 @@ void
sfi_value_take_rec (GValue *value,
SfiRec *rec)
{
- g_return_if_fail (SFI_VALUE_HOLDS_REC (value));
+ assert_return (SFI_VALUE_HOLDS_REC (value));
g_value_take_boxed (value, rec);
}
@@ -322,7 +322,7 @@ sfi_value_take_rec (GValue *value,
SfiProxy
sfi_value_get_proxy (const GValue *value)
{
- g_return_val_if_fail (SFI_VALUE_HOLDS_PROXY (value), 0);
+ assert_return (SFI_VALUE_HOLDS_PROXY (value), 0);
return (SfiProxy) g_value_get_pointer (value);
}
@@ -331,7 +331,7 @@ void
sfi_value_set_proxy (GValue *value,
SfiProxy proxy)
{
- g_return_if_fail (SFI_VALUE_HOLDS_PROXY (value));
+ assert_return (SFI_VALUE_HOLDS_PROXY (value));
g_value_set_pointer (value, (gpointer) proxy);
}
@@ -340,8 +340,8 @@ void
sfi_value_copy_deep (const GValue *src_value,
GValue *dest_value)
{
- g_return_if_fail (G_IS_VALUE (src_value));
- g_return_if_fail (G_IS_VALUE (dest_value));
+ assert_return (G_IS_VALUE (src_value));
+ assert_return (G_IS_VALUE (dest_value));
SfiSCategory scat = SfiSCategory (sfi_categorize_type (G_VALUE_TYPE (src_value)) & SFI_SCAT_TYPE_MASK);
switch (scat)
@@ -349,7 +349,7 @@ sfi_value_copy_deep (const GValue *src_value,
case SFI_SCAT_SEQ:
{
SfiSeq *seq;
- g_return_if_fail (SFI_VALUE_HOLDS_SEQ (dest_value));
+ assert_return (SFI_VALUE_HOLDS_SEQ (dest_value));
seq = sfi_value_get_seq (src_value);
sfi_value_take_seq (dest_value, seq ? sfi_seq_copy_deep (seq) : NULL);
}
@@ -357,7 +357,7 @@ sfi_value_copy_deep (const GValue *src_value,
case SFI_SCAT_REC:
{
SfiRec *rec;
- g_return_if_fail (SFI_VALUE_HOLDS_REC (dest_value));
+ assert_return (SFI_VALUE_HOLDS_REC (dest_value));
rec = sfi_value_get_rec (src_value);
sfi_value_take_rec (dest_value, rec ? sfi_rec_copy_deep (rec) : NULL);
}
@@ -365,7 +365,7 @@ sfi_value_copy_deep (const GValue *src_value,
case SFI_SCAT_BBLOCK:
{
SfiBBlock *bblock;
- g_return_if_fail (SFI_VALUE_HOLDS_BBLOCK (dest_value));
+ assert_return (SFI_VALUE_HOLDS_BBLOCK (dest_value));
bblock = sfi_value_get_bblock (src_value);
sfi_value_take_bblock (dest_value, bblock ? sfi_bblock_copy_deep (bblock) : NULL);
}
@@ -373,7 +373,7 @@ sfi_value_copy_deep (const GValue *src_value,
case SFI_SCAT_FBLOCK:
{
SfiFBlock *fblock;
- g_return_if_fail (SFI_VALUE_HOLDS_FBLOCK (dest_value));
+ assert_return (SFI_VALUE_HOLDS_FBLOCK (dest_value));
fblock = sfi_value_get_fblock (src_value);
sfi_value_take_fblock (dest_value, fblock ? sfi_fblock_copy_deep (fblock) : NULL);
}
@@ -397,7 +397,7 @@ alloc_value (GType type)
void
sfi_value_free (GValue *value)
{
- g_return_if_fail (value != NULL);
+ assert_return (value != NULL);
if (G_VALUE_TYPE (value))
g_value_unset (value);
sfi_delete_struct (GValue, value);
@@ -415,7 +415,7 @@ sfi_value_clone_deep (const GValue *value)
{
GValue *dest;
- g_return_val_if_fail (value != NULL, NULL);
+ assert_return (value != NULL, NULL);
dest = sfi_value_empty ();
if (G_IS_VALUE (value))
@@ -431,7 +431,7 @@ sfi_value_clone_shallow (const GValue *value)
{
GValue *dest;
- g_return_val_if_fail (value != NULL, NULL);
+ assert_return (value != NULL, NULL);
dest = sfi_value_empty ();
if (G_IS_VALUE (value))
@@ -511,7 +511,7 @@ sfi_value_lchoice (const gchar *vchoice,
GValue*
sfi_value_choice_enum (const GValue *enum_value)
{
- g_return_val_if_fail (G_VALUE_HOLDS_ENUM (enum_value), NULL);
+ assert_return (G_VALUE_HOLDS_ENUM (enum_value), NULL);
GEnumClass *eclass = (GEnumClass*) g_type_class_ref (G_VALUE_TYPE (enum_value));
GEnumValue *ev = g_enum_get_value (eclass, g_value_get_enum (enum_value));
@@ -616,12 +616,12 @@ sfi_value_choice2enum (const GValue *choice_value,
const char *eval;
uint i;
- g_return_if_fail (SFI_VALUE_HOLDS_CHOICE (choice_value));
- g_return_if_fail (G_VALUE_HOLDS_ENUM (enum_value));
+ assert_return (SFI_VALUE_HOLDS_CHOICE (choice_value));
+ assert_return (G_VALUE_HOLDS_ENUM (enum_value));
if (fallback_param)
{
- g_return_if_fail (G_IS_PARAM_SPEC_ENUM (fallback_param));
- g_return_if_fail (G_VALUE_HOLDS (enum_value, G_PARAM_SPEC_VALUE_TYPE (fallback_param)));
+ assert_return (G_IS_PARAM_SPEC_ENUM (fallback_param));
+ assert_return (G_VALUE_HOLDS (enum_value, G_PARAM_SPEC_VALUE_TYPE (fallback_param)));
}
GEnumClass *eclass = (GEnumClass*) g_type_class_ref (G_VALUE_TYPE (enum_value));
@@ -667,8 +667,8 @@ void
sfi_value_enum2choice (const GValue *enum_value,
GValue *choice_value)
{
- g_return_if_fail (SFI_VALUE_HOLDS_CHOICE (choice_value));
- g_return_if_fail (G_VALUE_HOLDS_ENUM (enum_value));
+ assert_return (SFI_VALUE_HOLDS_CHOICE (choice_value));
+ assert_return (G_VALUE_HOLDS_ENUM (enum_value));
GEnumClass *eclass = (GEnumClass*) g_type_class_ref (G_VALUE_TYPE (enum_value));
GEnumValue *ev = g_enum_get_value (eclass, g_value_get_enum (enum_value));
diff --git a/sfi/sfivmarshal.cc b/sfi/sfivmarshal.cc
index 4cad19d..2c086cf 100644
--- a/sfi/sfivmarshal.cc
+++ b/sfi/sfivmarshal.cc
@@ -110,7 +110,7 @@ sfi_vmarshal_void (void *func,
guint32 sig;
guint i;
- g_return_if_fail (n_args <= SFI_VMARSHAL_MAX_ARGS);
+ assert_return (n_args <= SFI_VMARSHAL_MAX_ARGS);
sig = 0;
for (i = 0; i < n_args; i++)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]