evas/font: simplify handling strings when constructing font names

no need to strcpy here when we can just pass the length to stringshare directly

CID 1382854

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D10441
This commit is contained in:
Mike Blumenkrantz 2019-10-17 10:28:55 -04:00
parent 5048ccf97e
commit 45edca0f6d
1 changed files with 3 additions and 4 deletions

View File

@ -1264,10 +1264,9 @@ object_text_font_cache_dir_add(char *dir)
char *p;
fn->type = 0;
strcpy(tmp2, file);
p = strrchr(tmp2, '.');
if (p) *p = 0;
fn->simple.name = eina_stringshare_add(tmp2);
p = strrchr(file, '.');
if (p) fn->simple.name = eina_stringshare_add_length(file, p - file);
else fn->simple.name = eina_stringshare_add(file);
eina_file_path_join(tmp2, PATH_MAX, dir, file);
fn->path = eina_stringshare_add(tmp2);
fd->fonts = eina_list_append(fd->fonts, fn);