ryuan pushed a commit to branch master.

commit 1ce99e109650f39f1242176044648591e6f83488
Author: Ryuan Choi <[email protected]>
Date:   Tue Jun 25 19:30:56 2013 +0900

    elm_font: Remove unnecessary realloc
---
 src/lib/elm_font.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/src/lib/elm_font.c b/src/lib/elm_font.c
index ea88885..2f7a4ec 100644
--- a/src/lib/elm_font.c
+++ b/src/lib/elm_font.c
@@ -33,12 +33,7 @@ _elm_font_properties_get(Eina_Hash **font_hash,
         if (subname)
           {
              len = subname - name;
-             name = realloc(name, sizeof(char) * len + 1);
-             if (name)
-               {
-                  memset(name, 0, sizeof(char) * len + 1);
-                  strncpy(name, font, len);
-               }
+             *subname = '\0';
           }
 
         /* add a font name */
@@ -53,7 +48,7 @@ _elm_font_properties_get(Eina_Hash **font_hash,
                   return NULL;
                }
 
-             efp->name = eina_stringshare_add(name);
+             efp->name = eina_stringshare_add_length(name, len);
              if (font_hash)
                {
                   if (!*font_hash)

-- 

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev

Reply via email to