solstice

Compute collected power and efficiencies of a solar plant
git clone git://git.meso-star.com/solstice.git
Log | Files | Refs | README | LICENSE

commit 91c4ecd40ca36394bf66e348712e4a42e236a445
parent 153c919e3092e927f916b89df44a5dd5fb3cea89
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Fri, 13 Jan 2017 12:33:09 +0100

Merge branch 'master' of gitlab.com:meso-star/solstice

Diffstat:
Msrc/solstice.c | 2+-
Msrc/solstice_entity.c | 5++++-
Msrc/solstice_object.c | 12+++++++++---
3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/src/solstice.c b/src/solstice.c @@ -327,7 +327,7 @@ solstice_release(struct solstice* solstice) clear_materials(&solstice->materials); clear_objects(&solstice->objects); clear_nodes(&solstice->roots); - /* don't clear pivots, as they are cleared from some root */ + /* Don't clear pivots, as they are cleared from some root */ if(solstice->ssol) SSOL(device_ref_put(solstice->ssol)); if(solstice->scene) SSOL(scene_ref_put(solstice->scene)); if(solstice->parser) solparser_ref_put(solstice->parser); diff --git a/src/solstice_entity.c b/src/solstice_entity.c @@ -252,7 +252,10 @@ solstice_setup_entities(struct solstice* solstice) entity = solparser_get_entity(solstice->parser, entity_id); root = create_node(solstice, entity); - if(!root) goto error; + if(!root) { + res = RES_BAD_ARG; + goto error; + } /* Initialialised the world space position of the entity geometry */ res = sanim_node_visit_tree diff --git a/src/solstice_object.c b/src/solstice_object.c @@ -426,9 +426,12 @@ solstice_instantiate_geometry struct ssol_instance** out_inst) { struct ssol_instance* inst = NULL; + struct ssol_material* front = NULL; + struct ssol_material* back = NULL; struct ssol_object** pssol_obj = NULL; struct ssol_object* ssol_obj = NULL; struct ssol_object* ssol_obj_new = NULL; + struct ssol_shape* shape = NULL; int is_attached_to_scn = 0; int is_registered = 0; res_T res = RES_OK; @@ -452,9 +455,6 @@ solstice_instantiate_geometry nobjs = solparser_geometry_get_objects_count(geom); FOR_EACH(iobj, 0, nobjs) { struct solparser_object_id obj_id; - struct ssol_shape* shape = NULL; - struct ssol_material* front; - struct ssol_material* back; obj_id = solparser_geometry_get_object(geom, iobj); res = create_shaded_shape(solstice, obj_id, &front, &back, &shape); @@ -472,6 +472,9 @@ solstice_instantiate_geometry SSOL(shape_ref_put(shape)); SSOL(material_ref_put(front)); SSOL(material_ref_put(back)); + shape = NULL; + front = NULL; + back = NULL; } } @@ -504,6 +507,9 @@ error: if(is_registered) htable_object_erase(&solstice->objects, &geom_id.i); if(inst) SSOL(instance_ref_put(inst)), inst = NULL; if(ssol_obj_new) SSOL(object_ref_put(ssol_obj_new)); + if(shape) SSOL(shape_ref_put(shape)); + if(front) SSOL(material_ref_put(front)); + if(back) SSOL(material_ref_put(back)); goto exit; }