Instead of keeping the full NT path and computing it later.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/gdi32/freetype.c | 40 +++++++++++++--------------------------- 1 file changed, 13 insertions(+), 27 deletions(-)
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index d2c47b0a263..39775b6ff5a 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -271,7 +271,7 @@ typedef struct tagFace { unsigned int refcount; WCHAR *style_name; WCHAR *full_name; - WCHAR *file; + WCHAR *file_name; const char *unix_name; dev_t dev; ino_t ino; @@ -1040,7 +1040,6 @@ static Face *find_face_from_filename(const WCHAR *file_name, const WCHAR *face_n { Family *family; Face *face; - const WCHAR *file;
TRACE("looking for file %s name %s\n", debugstr_w(file_name), debugstr_w(face_name));
@@ -1051,14 +1050,8 @@ static Face *find_face_from_filename(const WCHAR *file_name, const WCHAR *face_n face_list = get_face_list_from_family(family); LIST_FOR_EACH_ENTRY(face, face_list, Face, entry) { - if (!face->file) - continue; - file = strrchrW(face->file, '/'); - if(!file) - file = face->file; - else - file++; - if(strcmpiW(file, file_name)) continue; + if (!face->file_name) continue; + if (strcmpiW( face->file_name, file_name )) continue; face->refcount++; return face; } @@ -1540,6 +1533,7 @@ static Face *face_create( const char *unix_name, DWORD face_index, void *font_da { struct stat st; DWORD length = 0; + const char *file_name; Face *face; int fd;
@@ -1564,7 +1558,11 @@ static Face *face_create( const char *unix_name, DWORD face_index, void *font_da { face->unix_name = (char *)(face + 1); strcpy( (char *)face->unix_name, unix_name ); - face->file = towstr( CP_UNIXCP, face->unix_name ); + + if ((file_name = strrchr( face->unix_name, '/' ))) file_name++; + else file_name = face->unix_name; + face->file_name = towstr( CP_UNIXCP, file_name ); + face->dev = st.st_dev; face->ino = st.st_ino; } @@ -1591,7 +1589,7 @@ static void release_face( Face *face ) list_remove( &face->entry ); release_family( face->family ); } - HeapFree( GetProcessHeap(), 0, face->file ); + HeapFree( GetProcessHeap(), 0, face->file_name ); HeapFree( GetProcessHeap(), 0, face->style_name ); HeapFree( GetProcessHeap(), 0, face->full_name ); HeapFree( GetProcessHeap(), 0, face->cached_enum_data ); @@ -2602,13 +2600,8 @@ static void populate_system_links(const WCHAR *name, const WCHAR *const *values) face_list = get_face_list_from_family(family); LIST_FOR_EACH_ENTRY(face, face_list, Face, entry) { - if (!face->file) - continue; - file = strrchrW(face->file, '/'); - if (!file) - file = face->file; - else - file++; + if (!face->file_name) continue; + file = face->file_name; break; } if (!file) @@ -3235,14 +3228,7 @@ static void update_reg_entries(void) } file = path; } - else if ((file = strrchrW(face->file, '/'))) - { - file++; - } - else - { - file = face->file; - } + else file = face->file_name;
len = strlenW(file) + 1; RegSetValueExW(winnt_key, valueW, 0, REG_SZ, (BYTE*)file, len * sizeof(WCHAR));