comparison path.c @ 32543:18338ee51c9d

Export mp_basename in a function instead of duplicate macros in various places
author cboesch
date Tue, 16 Nov 2010 21:06:52 +0000
parents b32527b30d17
children 9d5d8c799869
comparison
equal deleted inserted replaced
32542:775be5bfdcb3 32543:18338ee51c9d
191 } 191 }
192 codec_path = malloc(strlen(path) + 1); 192 codec_path = malloc(strlen(path) + 1);
193 strcpy(codec_path, path); 193 strcpy(codec_path, path);
194 needs_free = 1; 194 needs_free = 1;
195 } 195 }
196
197 const char *mp_basename(const char *path)
198 {
199 char *s;
200
201 #if HAVE_DOS_PATHS
202 s = strrchr(path, '\\');
203 if (s)
204 return s + 1;
205 #endif
206 s = strrchr(path, '/');
207 return s ? s + 1 : s;
208 }