[PATCH] Make use of mp_basename in a few places
Hi, Since mp_basename seems to work, I think it could be nice to use it all over the code instead of various hacky strrstr. Here is a patch to fix most of them. -- Clément B. Not sent from a jesusPhone.
On Sat, Dec 04, 2010 at 12:05:38AM +0100, Clément Bœsch wrote:
@@ -95,11 +96,7 @@ static rar_stream_t *rar_open(const char *const filename, strcat(rar_filename, ".rar"); } /* get rid of the path if there is any */ - if ((p = strrchr(filename, '/')) == NULL) { - p = filename; - } else { - p++; - } + p = (char *)mp_basename(filename);
Huh? p is already const char *, this cast should be pointless. Apart from that, considering that most of those implementations you are replacing are buggy I'd say go ahead, can't break already broken code that much.
On Sat, Dec 04, 2010 at 11:17:05AM +0100, Reimar Döffinger wrote:
On Sat, Dec 04, 2010 at 12:05:38AM +0100, Clément Bœsch wrote:
@@ -95,11 +96,7 @@ static rar_stream_t *rar_open(const char *const filename, strcat(rar_filename, ".rar"); } /* get rid of the path if there is any */ - if ((p = strrchr(filename, '/')) == NULL) { - p = filename; - } else { - p++; - } + p = (char *)mp_basename(filename);
Huh? p is already const char *, this cast should be pointless.
Oups, fixed.
Apart from that, considering that most of those implementations you are replacing are buggy I'd say go ahead, can't break already broken code that much.
Thanks, applied. -- Clément B. Not sent from a jesusPhone.
participants (2)
-
Clément Bœsch -
Reimar Döffinger