[Spice-devel] [PATCH] log: add not fatal spice_return function

Christophe Fergeau cfergeau at redhat.com
Thu Nov 19 09:42:57 PST 2015


Hey,

On Thu, Nov 19, 2015 at 06:58:41AM -0500, Frediano Ziglio wrote:
> > 
> > Hi
> > 
> > ----- Original Message -----
> > > Due to implementation details spice_return is by default fatal (program
> > > is aborting). This is quite confusing but changing the current macros
> > > would possibly break existing code.
> > > Add not fatal (at least by default) macros. They use warning level
> > > instead of criticial.
> > > This is also compatible with Glib macros.
> > 
> > Why not start using glib macros instead?
> > 
> 
> starting would mean:
> - have half call to old and half to new with 2 different behavior);
> - switch all to glib changing behavior and making hard to switch back.
> 
> Adding new macros more compatible with glib but 100% compatible with current
> code make the transition more smooth.

What do you mean by "100% compatible with the current code"? (why is
g_return_if-fail() not "100% compatible with the current code" ?)

> 
> For instance we could change the assert to spice_return_*warning now knowing
> that we can safely convert to g_return* in the future.

I agree with Marc-André, it's better to directly glib macros here
rather than introducing our own once again. We should try to have less
duplication with glib, not more. The spice_return_if_fail situation is
unfortunate (that it asserts), but I'd clarify this by (optionally)
renaming spice_return_if_fail() and using g_return_if_fail() rather than
having spice_return_if_fail() and spice_return_if_fail_warn().

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20151119/d65915e3/attachment.sig>


More information about the Spice-devel mailing list