[MPlayer-dev-eng] Export mp_basename in a function
Kevin DeKorte
kdekorte at gmail.com
Thu Nov 11 20:53:25 CET 2010
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 11/11/2010 12:44 PM, Reimar Döffinger wrote:
> 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).
Any particular reason you are not using the GNU version of basename at
least for the non-windows code path? (man 3 basename)
Kevin
- --
Get my public GnuPG key from
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x7D0BD5D1
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAkzcSbUACgkQ6w2kMH0L1dHViwCeMG7n6+NJX//FtcAWQsIa7a2P
wK0Anj3P3UtIb2gvyP/n/aSKHhGoP5o6
=x3L5
-----END PGP SIGNATURE-----
More information about the MPlayer-dev-eng
mailing list