[Spice-devel] [PATCH spice-streaming-server 1/3] Use defer style destruction instead of old C style and goto

Christophe Fergeau cfergeau at redhat.com
Thu Nov 9 12:48:47 UTC 2017


On Thu, Nov 09, 2017 at 07:25:20AM -0500, Frediano Ziglio wrote:
> > 
> > On Wed, Nov 08, 2017 at 03:02:35PM +0000, Frediano Ziglio wrote:
> > > This better integrate with exceptions.
> > > Also don't leak resources using a return in the middle of the
> > > code.
> > > 
> > > Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> > > ---
> > >  src/Makefile.am               |  1 +
> > >  src/defer.hpp                 | 16 ++++++++++++++++
> > >  src/spice-streaming-agent.cpp | 16 ++++++++--------
> > >  3 files changed, 25 insertions(+), 8 deletions(-)
> > >  create mode 100644 src/defer.hpp
> > > 
> > > diff --git a/src/Makefile.am b/src/Makefile.am
> > > index 8d5c5bd..ec1969a 100644
> > > --- a/src/Makefile.am
> > > +++ b/src/Makefile.am
> > > @@ -56,4 +56,5 @@ spice_streaming_agent_SOURCES = \
> > >  	mjpeg-fallback.cpp \
> > >  	jpeg.cpp \
> > >  	jpeg.hpp \
> > > +	defer.hpp \
> > >  	$(NULL)
> > > diff --git a/src/defer.hpp b/src/defer.hpp
> > > new file mode 100644
> > > index 0000000..93931fe
> > > --- /dev/null
> > > +++ b/src/defer.hpp
> > > @@ -0,0 +1,16 @@
> > > +// see
> > > https://stackoverflow.com/questions/32432450/what-is-standard-defer-finalizer-implementation-in-c
> > 
> > Is there any license associated with that code snippet?
> > 
> > Christophe
> > 
> 
> Good question, looks like MIT, see https://meta.stackexchange.com/questions/271080/the-mit-license-clarity-on-using-code-on-stack-overflow-and-stack-exchange

Indeed, looks like it, thanks!

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20171109/30afb9dd/attachment.sig>


More information about the Spice-devel mailing list