Commit 71690f13 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

rar: call strchr() only once

parent b2f093c8
...@@ -143,14 +143,15 @@ int RarAccessOpen(vlc_object_t *object) ...@@ -143,14 +143,15 @@ int RarAccessOpen(vlc_object_t *object)
{ {
access_t *access = (access_t*)object; access_t *access = (access_t*)object;
if (!strchr(access->psz_location, '|')) const char *name = strchr(access->psz_location, '|');
if (name == NULL)
return VLC_EGENERIC; return VLC_EGENERIC;
char *base = strdup(access->psz_location); char *base = strndup(access->psz_location, name - access->psz_location);
if (!base) if (unlikely(base == NULL))
return VLC_EGENERIC; return VLC_ENOMEM;
char *name = strchr(base, '|');
*name++ = '\0'; name++;
decode_URI(base); decode_URI(base);
stream_t *s = stream_UrlNew(access, base); stream_t *s = stream_UrlNew(access, base);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment