Hi,

2013/3/20 Bernhard Reutner-Fischer <[email protected]>:
> On 20 March 2013 02:14:39 [email protected] wrote:
>>
>> From: Guilherme Maciel Ferreira <[email protected]>
>>
>> Signed-off-by: Guilherme Maciel Ferreira
>> <[email protected]>
>> ---
>>  include/libbb.h   |    5 +++++
>>  networking/wget.c |   14 ++++++++++++--
>>  2 files changed, 17 insertions(+), 2 deletions(-)
>>
>> diff --git a/include/libbb.h b/include/libbb.h
>> index 0690dca..25dc146 100644
>> --- a/include/libbb.h
>> +++ b/include/libbb.h
>> @@ -1763,6 +1763,11 @@ extern struct globals *const ptr_to_globals;
>>         (*(struct globals**)&ptr_to_globals) = (void*)(x); \
>>         barrier(); \
>>  } while (0)
>> +#define FREE_PTR_TO_GLOBALS() do { \
>> +       if (ENABLE_FEATURE_CLEAN_UP && ptr_to_globals) { \
>
>
> free(NULL) is perfectly valid.
>

OK.

>
>> +               free(ptr_to_globals); \
>> +       } \
>> +} while (0)
>>
>>  /* You can change LIBBB_DEFAULT_LOGIN_SHELL, but don't use it,
>>   * use bb_default_login_shell and following defines.
>> diff --git a/networking/wget.c b/networking/wget.c
>> index 4eafebe..6e18835 100644
>> --- a/networking/wget.c
>> +++ b/networking/wget.c
>> @@ -86,10 +86,12 @@ struct globals {
>>  } FIX_ALIASING;
>>  #define G (*ptr_to_globals)
>>  #define INIT_G() do { \
>> -        SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
>> +       SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
>>         IF_FEATURE_WGET_TIMEOUT(G.timeout_seconds = 900;) \
>
>
> What does the change above do?
>

It is simply a indentation replacement, from 8 spaces to tab.

>
>>  } while (0)
>> -
>> +#define FINISH_G() do { \
>
>
> I'd prefer FINI_G(). init/fini is a commonly used pair.
>

OK.

>
>> +       FREE_PTR_TO_GLOBALS(); \
>> +} while(0)
>>
>>  /* Must match option string! */
>>  enum {
>> @@ -987,5 +989,13 @@ int wget_main(int argc UNUSED_PARAM, char **argv)
>>         if (G.output_fd >= 0)
>>                 xclose(G.output_fd);
>>
>> +#if ENABLE_FEATURE_WGET_LONG_OPTIONS
>> +       if (ENABLE_FEATURE_CLEAN_UP && G.extra_headers) {
>
>
> The idea behind these ENABLE defines was to increase preprocessor coverage.
> You should likely move the condition from CPP to c.

I not sure if I understood exactly what you mean here. Did you mean to
add the ENABLE_FEATURE_CLEAN_UP to the preprocessor condition, like
this:

#if ENABLE_FEATURE_WGET_LONG_OPTIONS && ENABLE_FEATURE_CLEAN_UP
        if (G.extra_headers) {
                free(G.extra_headers);
        }
#endif

or, on the other hand, by the second sentence I understood you meant
to do not use the preprocessor:

if (ENABLE_FEATURE_WGET_LONG_OPTIONS && ENABLE_FEATURE_CLEAN_UP &&
G.extra_headers) {
        free(G.extra_headers);
}

>
> Thanks,
>
>> +               free(G.extra_headers);
>> +       }
>> +#endif
>> +
>> +       FINISH_G();
>> +
>>         return EXIT_SUCCESS;
>>  }
>> --
>> 1.7.0.4

Best regards,

-- 
Guilherme Maciel Ferreira
Mobile Brazil: +55 48 9904 3728 e +55 48 9134 4651
Site: http://guilhermemacielferreira.com/
Skype: guilherme.maciel.ferreira
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to