bug-wget
[Top][All Lists]
Advanced

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

Re: [Bug-wget] gethttp cleanup


From: Tim Rühsen
Subject: Re: [Bug-wget] gethttp cleanup
Date: Sun, 19 Apr 2015 20:01:13 +0200
User-agent: KMail/4.14.2 (Linux/3.16.0-4-amd64; KDE/4.14.2; x86_64; ; )

Am Donnerstag, 9. April 2015, 23:41:22 schrieb Hubert Tarasiuk:
> W dniu 01.04.2015 o 17:01, Giuseppe Scrivano pisze:
> > Hubert Tarasiuk <address@hidden> writes:
> >> When these two issues are dealt with, a common cleanup code for
> >> `gethttp` will be easily possible for variables:
> >> - req
> >> - resp
> >> - head
> >> - message
> >> - type
> > 
> > I went ahead and pushed your patches!
> 
> Hello developers,
> 
> I have prepared common cleanup code for the following variables in
> http.c (gethttp):
> req, resp, head, message, type
> 
> I added a single exit point to that function.
> 
> It should be a good starting point for further refactoring inside that
> function.
> 
> Please have a look at the patch and let me know what do you think about it.
> 
> I was thinking about a simple macro like:
> > #define GETHTTP_CLEAN_RETURN(x) do\
> > 
> >   {\
> >   
> >     retval = (x);\
> >     goto cleanup;\
> >   
> >   }\
> 
> Then instead of writing:
> > retval = XYZ;
> > goto cleanup;
> 
> we could simply write:
> > GETHTTP_CLEAN_RETURN (XYZ);
> 
> However I am not sure if it will not obfuscate the code, or if it is
> good style/convention.

It depends on whom you ask :-)
I think it is good style to have one 'cleanup/exit' code. I find it easier to 
read, leaks are more obvious.

If no one complains (well, no one did so far), I'll push the code tomorrow.

Thanks for your works, Hubert.

Tim

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]