Re: Reducing the weight of g_return_if_fail()



On Mon, 12 Apr 2004, Owen Taylor wrote:

> All the g_return_if_fail() statements tend to increase the size of
> Glib, GTK+, etc, quite a bit.
>
> The attached patch, changes the GCC branch of of the g_return_if_fail()
> definition to:
>
>  - Removes the file/line information when we have __PRETTY_FUNC__; it's
>    really just useless clutter for the common use of g_return_if_fail()
>    to check assertions on entry
>
>  - Uses a helper function to avoid hardcoding the format string into
>    every function
>
> As an example of the how this helps:
>
>  libgobject gets 10% smaller (saves 20k out of 210k)
>  libgtk gets 4% smaller (saves 80k of 2.4M)
>
> 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" ?

>
> Regards,
> 							Owen
>

---
ciaoTJ




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]