[MPlayer-dev-eng] Export mp_basename in a function

Reimar Döffinger Reimar.Doeffinger at gmx.de
Thu Nov 11 20:44:53 CET 2010


On Thu, Nov 11, 2010 at 05:32:14PM +0100, Clément Bœsch wrote:
> @@ -193,3 +193,16 @@ void set_codec_path(const char *path)
>      strcpy(codec_path, path);
>      needs_free = 1;
>  }
> +
> +char *mp_basename(char *path)
> +{
> +	char *s;
> +
> +#if HAS_DOS_PATHS
> +	s = strrchr(path, '\\');
> +	if (s)
> +		return s + 1;
> +#endif
> +	s = strrchr(path, '/');
> +	return s ? s + 1 : s;
> +}

Please use 4 spaces for indentation if you add a completely new
function and the surrounding code does not consistently use
something else.
Also please use "const char" instead of "char" (I think
you might have to change some more code to avoid new warnings,
but I think it should be possible without real issues).


More information about the MPlayer-dev-eng mailing list