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

Marc-André Lureau mlureau at redhat.com
Thu Nov 19 09:48:17 PST 2015



----- Original Message -----
> 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().

Note that all spice_return*_if_fail() in spice-common should be safe to move to g_return_if_fail() when I did the conversion (spice-gtk doesn't use fatal spice_return)

> 
> Christophe
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 


More information about the Spice-devel mailing list