[vlc-devel] Re: Podcast improvement

Vincent Maury dimar at via.ecp.fr
Wed Mar 21 20:51:41 CET 2007


Rémi Denis-Courmont a écrit :
> On Tuesday 20 March 2007 01:36:14 Vincent Maury wrote:
>> I need your help in order to show me the good way for coding in vlc.
>> This patch is certainly full of bugs, but I can't see where they are.
> 
> Please:
> - use size_t for strlen() result,
> - do not assume you can realloc the result of var_*(),
> - use the stack for local string variable instead of malloc/realloc.
> 
> Also, this:
> +    int len = strlen( psz_vlcrc );
> +    psz_vlcrc[len] = 0; /* Delete the last | */
> is a no-op.

I think I see the error (a very stupid one).
psz_vlcrc[len-1] = 0; may work fine.

> If you want to remove the last pipe, or clear the whole variable if there is 
> none, that's one way to do it:
> 
> 	char *ptr = strrchr (psz_vlcrc) ?: psz_vlcrc;
> 	assert (ptr != NULL);
> 	*ptr = '\0';

The *prt pointer why be empty each time the user delete his last podcast
from the list, did we need a debug function looking for this behavior ?

> Regards,
> 

Many thank for all the advises.
-- 
Vincent (Dimar)

-- 
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html



More information about the vlc-devel mailing list