[vlc-devel] [vlc-commits] FromLocaleDup(): accept NULL input (and return NULL)

Rafaël Carré rafael.carre at gmail.com
Tue Aug 30 14:51:35 CEST 2011


Le Tue, 30 Aug 2011 08:28:03 +0200,
Rémi Denis-Courmont <remi at remlab.net> a écrit :

> On Tue, 30 Aug 2011 05:31:06 +0200 (CEST), git at videolan.org (Rafaël
> Carré) wrote:
> > vlc | branch: master | Rafaël Carré <rafael.carre at gmail.com> | Mon
> > Aug
> 29
> > 22:07:25 2011 -0400| [3ab2f937b7f2dbd77e4cd161ef926ecb07dc147b] |
> > committer: Rafaël Carré
> > 
> > FromLocaleDup(): accept NULL input (and return NULL)
> 
> I don't really like this. I much prefer the same pattern as strdup().
> Reworking the code is much easier when you know that the caller
> cannot pass NULL.

OK if you prefer this way.

I changed the function and not the callers because it is not documented
in the header, and in the source it says it'll return NULL in "case of
error", and it also felt safer.

-- 
Rafaël Carré



More information about the vlc-devel mailing list