Commit: 41d23116aa4ed36aec8b480ce2fc207d72ad88ce
Author: Campbell Barton
Date:   Thu Feb 6 01:02:22 2014 +1100
https://developer.blender.org/rB41d23116aa4ed36aec8b480ce2fc207d72ad88ce

Scanfill: malloc arrays and zero init members

===================================================================

M       source/blender/blenkernel/BKE_lattice.h
M       source/blender/blenlib/BLI_kdopbvh.h
M       source/blender/blenlib/intern/scanfill.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_lattice.h 
b/source/blender/blenkernel/BKE_lattice.h
index c7e9fe5..d4d765d 100644
--- a/source/blender/blenkernel/BKE_lattice.h
+++ b/source/blender/blenkernel/BKE_lattice.h
@@ -50,11 +50,7 @@ void BKE_lattice_make_local(struct Lattice *lt);
 void calc_lat_fudu(int flag, int res, float *r_fu, float *r_du);
 
 struct LatticeDeformData;
-struct LatticeDeformData *init_latt_deform(struct Object *oblatt, struct 
Object *ob)
-#ifdef __GNUC__
-__attribute__((warn_unused_result))
-#endif
-;
+struct LatticeDeformData *init_latt_deform(struct Object *oblatt, struct 
Object *ob) ATTR_WARN_UNUSED_RESULT;
 void calc_latt_deform(struct LatticeDeformData *lattice_deform_data, float 
co[3], float weight);
 void end_latt_deform(struct LatticeDeformData *lattice_deform_data);
 
@@ -94,5 +90,4 @@ int  BKE_lattice_index_flip(struct Lattice *lt, const int 
index,
 void BKE_lattice_bitmap_from_flag(struct Lattice *lt, unsigned int *bitmap, 
const short flag,
                                   const bool clear, const bool respecthide);
 
-#endif
-
+#endif  /* __BKE_LATTICE_H__ */
diff --git a/source/blender/blenlib/BLI_kdopbvh.h 
b/source/blender/blenlib/BLI_kdopbvh.h
index bf7bd3d..7b00fd9 100644
--- a/source/blender/blenlib/BLI_kdopbvh.h
+++ b/source/blender/blenlib/BLI_kdopbvh.h
@@ -39,8 +39,6 @@
 extern "C" { 
 #endif
 
-#include <float.h>
-
 struct BVHTree;
 typedef struct BVHTree BVHTree;
 
diff --git a/source/blender/blenlib/intern/scanfill.c 
b/source/blender/blenlib/intern/scanfill.c
index 5ef8f33..2f4c97e 100644
--- a/source/blender/blenlib/intern/scanfill.c
+++ b/source/blender/blenlib/intern/scanfill.c
@@ -471,7 +471,7 @@ static unsigned int scanfill(ScanFillContext *sf_ctx, 
PolyFill *pf, const int fl
        /* STEP 1: make using FillVert and FillEdge lists a sorted
         * ScanFillVertLink list
         */
-       sc = scdata = (ScanFillVertLink *)MEM_callocN(pf->verts * 
sizeof(ScanFillVertLink), "Scanfill1");
+       sc = scdata = MEM_mallocN(sizeof(*scdata) * pf->verts, "Scanfill1");
        verts = 0;
        for (eve = sf_ctx->fillvertbase.first; eve; eve = eve->next) {
                if (eve->poly_nr == nr) {
@@ -479,6 +479,7 @@ static unsigned int scanfill(ScanFillContext *sf_ctx, 
PolyFill *pf, const int fl
                                verts++;
                                eve->f = 0;  /* flag for connectedges later on 
*/
                                sc->vert = eve;
+                               sc->edge_first = sc->edge_last = NULL;
                                /* if (even->tmp.v == NULL) eve->tmp.u = verts; 
*/ /* Note, debug print only will work for curve polyfill, union is in use for 
mesh */
                                sc++;
                        }
@@ -1014,12 +1015,14 @@ unsigned int BLI_scanfill_calc_ex(ScanFillContext 
*sf_ctx, const int flag, const
 
 
        /* STEP 3: MAKE POLYFILL STRUCT */
-       pflist = (PolyFill *)MEM_callocN((size_t)poly * sizeof(PolyFill), 
"edgefill");
+       pflist = MEM_mallocN(sizeof(*pflist) * (size_t)poly, "edgefill");
        pf = pflist;
        for (a = 1; a <= poly; a++) {
-               pf->nr = a;
+               pf->edges = pf->verts = 0;
                pf->min_xy[0] = pf->min_xy[1] =  1.0e20f;
                pf->max_xy[0] = pf->max_xy[1] = -1.0e20f;
+               pf->f = 0;
+               pf->nr = a;
                pf++;
        }
        for (eed = sf_ctx->filledgebase.first; eed; eed = eed->next) {
@@ -1057,8 +1060,8 @@ unsigned int BLI_scanfill_calc_ex(ScanFillContext 
*sf_ctx, const int flag, const
                        pf++;
                }
 #endif
-       
-               polycache = pc = MEM_callocN(sizeof(short) * (size_t)poly, 
"polycache");
+
+               polycache = pc = MEM_callocN(sizeof(*polycache) * (size_t)poly, 
"polycache");
                pf = pflist;
                for (a = 0; a < poly; a++, pf++) {
                        for (c = (unsigned short)(a + 1); c < poly; c++) {

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to