[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git
Subject:    Re: [PATCH] string-list.h: Add a value to string_list initializer lists
From:       Matthieu Moy <Matthieu.Moy () grenoble-inp ! fr>
Date:       2014-06-02 10:54:51
Message-ID: vpqa99vr37o.fsf () anie ! imag ! fr
[Download RAW message or body]

Tanay Abhra <tanayabh@gmail.com> writes:

> Add a NULL value in the end of STRING_LIST_INIT_NODUP and
> STRING_LIST_DUP to initialize `compare_strings_fn`.
>
> Signed-off-by: Tanay Abhra <tanayabh@gmail.com>
> ---
> When I used a malloced string_list to play around with string-list API and
> used the default init_list, it caused a seg fault. After an hour of debugging
> I saw that comapre_strings_fn should be initialized to NULL. In C, even an
> incomplete initialzer initializes every value to NULl or 0, so in normal
> usage in the codebase this problem never occurs. Still it is better to be
> thorough.

Part of this comment should be in the commit message itself. The "I
used ..." part should not (it is your experience), but the last two
sentences make sense IMHO.

Other than that, the changes sounds good.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic