raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=ff67dd25e3c306f4e52ce44dba6c5037d7c51fa7

commit ff67dd25e3c306f4e52ce44dba6c5037d7c51fa7
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
Date:   Thu Jul 13 17:54:07 2017 +0900

    evas mesh save - use alloca for tmp strings instead of heap
    
    this reduces code and means we dont have to handle NULL exceptions as
    alloca always "works".
    
    @fix
---
 src/modules/evas/model_savers/obj/evas_model_save_obj.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/modules/evas/model_savers/obj/evas_model_save_obj.c 
b/src/modules/evas/model_savers/obj/evas_model_save_obj.c
index 7ecc4b7f75..f8b5491b2c 100644
--- a/src/modules/evas/model_savers/obj/evas_model_save_obj.c
+++ b/src/modules/evas/model_savers/obj/evas_model_save_obj.c
@@ -228,17 +228,14 @@ evas_model_save_file_obj(const Evas_Canvas3D_Mesh *mesh,
    Evas_Canvas3D_Material_Data *mat;
 
    len = strlen(_obj_file_name);
-   _without_extention = (char *)malloc(len - 3);
-   _mtl_file_name = (char *)malloc(len + 1);
+   _without_extention = alloca(len - 3);
+   _mtl_file_name = alloca(len + 1);
    eina_strlcpy(_without_extention, _obj_file_name, len - 3);
    eina_str_join(_mtl_file_name, len + 1, '.', _without_extention, "mtl");
-   free(_without_extention);
 
    Evas_Canvas3D_Mesh_Data *pd = efl_data_scope_get(mesh, 
EVAS_CANVAS3D_MESH_CLASS);
    mat = efl_data_scope_get(f->material, EVAS_CANVAS3D_MATERIAL_CLASS);
 
    if (mat != NULL) _save_material(pd, _mtl_file_name, mat);
    _save_mesh(pd, _obj_file_name, _mtl_file_name, f);
-
-   free(_mtl_file_name);
 }

-- 


Reply via email to