summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-07-13 17:54:07 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-07-16 15:56:02 +0900
commitff67dd25e3c306f4e52ce44dba6c5037d7c51fa7 (patch)
tree0f498b92e2c3df2c39ed76b466d1cc1cd13e57be
parent665679bc423ee81cf97fe26b30560bb611e9deba (diff)
downloadefl-ff67dd25e3c306f4e52ce44dba6c5037d7c51fa7.tar.gz
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
-rw-r--r--src/modules/evas/model_savers/obj/evas_model_save_obj.c7
1 files 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);
}