Re: Reducing the weight of g_return_if_fail()
- From: Tim Janik <timj gtk org>
- To: Owen Taylor <otaylor redhat com>
- Cc: Gtk+ Developers <gtk-devel-list gnome org>
- Subject: Re: Reducing the weight of g_return_if_fail()
- Date: Fri, 10 Sep 2004 02:33:54 +0200 (CEST)
On Thu, 9 Sep 2004, Owen Taylor wrote:
> On Tue, 2004-04-13 at 03:05, Tim Janik wrote:
> > O
> > > Which is a significant saving for such a tiny patch...
> >
> > looks good and makes sense to me. i'd just not call it
> > g_return_failed_internal, that sounds as if a "return"
> > failed. what's bad about "g_return_if_fail_internal" ?
>
> I want with g_return_if_fail_warning().
hm, looking at this again, i think putting "_return_" into
a function name is not a good idea, it's ok for the macros
though, since they actually do perform a "return" for you.
so, better name it straight:
+void g_assertion_failed (const char *log_domain,
+ const char *pretty_function,
+ const char *expression);
+
#define g_return_if_fail(expr) G_STMT_START{ \
if G_LIKELY(expr) { } else \
{ \
- g_log (G_LOG_DOMAIN, \
- G_LOG_LEVEL_CRITICAL, \
- "file %s: line %d (%s): assertion `%s' failed", \
- __FILE__, \
- __LINE__, \
- __PRETTY_FUNCTION__, \
- #expr); \
+ g_assertion_failed (G_LOG_DOMAIN, \
+ __PRETTY_FUNCTION__, \
+ #expr); \
return; \
};
>
> Regards,
> Owen
>
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]