bug-wget
[Top][All Lists]
Advanced

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

Re: [Bug-wget] gethttp cleanup


From: Hubert Tarasiuk
Subject: Re: [Bug-wget] gethttp cleanup
Date: Thu, 09 Apr 2015 23:41:22 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0

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.


Thank you,
Hubert

Attachment: 0003-Single-exit-point-and-common-cleanup-code-in-gethttp.patch
Description: Text Data

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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