From 17636a0c1c6cc7916d2b3f659b5a701266bcab36 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 1 Sep 2016 21:05:24 -0700 Subject: [PATCH] Calculate a variable closer to where it's used --- Alc/hrtf.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Alc/hrtf.c b/Alc/hrtf.c index d189ad35..19829034 100644 --- a/Alc/hrtf.c +++ b/Alc/hrtf.c @@ -691,11 +691,6 @@ static void AddFileEntry(vector_HrtfEntry *list, al_string *filename) const char *ext; int i; - name = strrchr(al_string_get_cstr(*filename), '/'); - if(!name) name = strrchr(al_string_get_cstr(*filename), '\\'); - if(!name) name = al_string_get_cstr(*filename); - else ++name; - #define MATCH_FNAME(i) (al_string_cmp_cstr(*filename, (i)->hrtf->filename) == 0) VECTOR_FIND_IF(iter, const HrtfEntry, *list, MATCH_FNAME); if(iter != VECTOR_END(*list)) @@ -759,6 +754,11 @@ static void AddFileEntry(vector_HrtfEntry *list, al_string *filename) skip_load: /* TODO: Get a human-readable name from the HRTF data (possibly coming in a * format update). */ + name = strrchr(al_string_get_cstr(*filename), '/'); + if(!name) name = strrchr(al_string_get_cstr(*filename), '\\'); + if(!name) name = al_string_get_cstr(*filename); + else ++name; + ext = strrchr(name, '.'); i = 0; -- 2.11.4.GIT