From 97e14e146c9feaf6b212dacef22bd0907c267b8a Mon Sep 17 00:00:00 2001 From: hermet Date: Wed, 2 May 2012 10:29:58 +0000 Subject: [PATCH] elementary/font - actually it doesnt append the font to the hash when font_hash is created inside. now it is fixed. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@70620 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/elm_font.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/src/lib/elm_font.c b/src/lib/elm_font.c index 43e9ebc..0cef199 100644 --- a/src/lib/elm_font.c +++ b/src/lib/elm_font.c @@ -39,23 +39,24 @@ _elm_font_properties_get(Eina_Hash **font_hash, strncpy(name, font, len); } } - if (!strncmp(s1, ELM_FONT_TOKEN_STYLE, strlen(ELM_FONT_TOKEN_STYLE))) { style = s1 + strlen(ELM_FONT_TOKEN_STYLE); - if (font_hash) efp = eina_hash_find(*font_hash, name); - if (!efp) + if (font_hash) { - efp = calloc(1, sizeof(Elm_Font_Properties)); - if (efp) + efp = eina_hash_find(*font_hash, name); + if (!efp) { - efp->name = eina_stringshare_add(name); - if ((font_hash && !*font_hash)) + efp = calloc(1, sizeof(Elm_Font_Properties)); + if (efp) { - *font_hash = eina_hash_string_superfast_new(NULL); + efp->name = eina_stringshare_add(name); + if (!*font_hash) + *font_hash = eina_hash_string_superfast_new(NULL); eina_hash_add(*font_hash, name, efp); } + } } s2 = strchr(style, ','); @@ -82,19 +83,14 @@ _elm_font_properties_get(Eina_Hash **font_hash, } else { - if (font_hash) efp = eina_hash_find(*font_hash, font); - if (!efp) + if ((font_hash) && (!eina_hash_find(*font_hash, font))) { efp = calloc(1, sizeof(Elm_Font_Properties)); - if (efp) - { - efp->name = eina_stringshare_add(font); - if (font_hash && !*font_hash) - { - *font_hash = eina_hash_string_superfast_new(NULL); - eina_hash_add(*font_hash, font, efp); - } - } + if (!efp) return NULL; + + efp->name = eina_stringshare_add(font); + if (!*font_hash) *font_hash = eina_hash_string_superfast_new(NULL); + eina_hash_add(*font_hash, font, efp); } } return efp; -- 2.7.4