[vlc-devel] Re: Podcast improvement

Rémi Denis-Courmont rem at videolan.org
Tue Mar 20 18:22:04 CET 2007


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.

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';

Regards,

-- 
Rémi Denis-Courmont

-- 
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