[vlc-devel] [PATCH 1/1] codec/dirac: Rewrite libdirac(-research) encoding support

Laurent Aimar fenrir at via.ecp.fr
Tue Nov 11 19:31:56 CET 2008


On Tue, Nov 11, 2008, David Flynn wrote:
> On 2008-11-11, Laurent Aimar <fenrir at via.ecp.fr> wrote:
> > On Mon, Nov 10, 2008, David Flynn wrote:
> >> >  psz_tmp may be NULL in case of allocation failure.`
> >> Pointless allocation failure checks be damned.
> >> I've just gone and deleted all the validation of psz_tmp sice it was
> >> pointed out it returned "", i'm a little peeved at having to put them
> >> all back.
> >  Well, it is the current policy, that new codes do not segfault on
> > allocation failure so ... 
> >  Using var_GetNonEmptyString may be the easiest way in your code, it will either
> > return NULL or a non empty string. It will merge the NULL and "" case in one.
> > (You can just handle allocation failures as a case where no value is provided)
> 
> I don't quite follow.
 psz_tmp = var_GetNonEmptyString();
 if( !psz_tmp ) {}
 else your code
is fine as long as the going through if(!psz_tmp){} is a valid code
path (no undefined variables or behaviours).

-- 
fenrir




More information about the vlc-devel mailing list