[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58981] trunk/blender/source/blender: code cleanup: more zero as NULL pointers.

Campbell Barton ideasman42 at gmail.com
Wed Aug 7 05:36:07 CEST 2013


Revision: 58981
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58981
Author:   campbellbarton
Date:     2013-08-07 03:36:05 +0000 (Wed, 07 Aug 2013)
Log Message:
-----------
code cleanup: more zero as NULL pointers.

Modified Paths:
--------------
    trunk/blender/source/blender/blenfont/BLF_api.h
    trunk/blender/source/blender/blenkernel/intern/dynamicpaint.c
    trunk/blender/source/blender/blenkernel/intern/image_gen.c
    trunk/blender/source/blender/blenkernel/intern/smoke.c
    trunk/blender/source/blender/blenkernel/intern/tracking.c
    trunk/blender/source/blender/blenlib/intern/scanfill.c
    trunk/blender/source/blender/blenlib/intern/voronoi.c
    trunk/blender/source/blender/editors/animation/keyframes_draw.c
    trunk/blender/source/blender/editors/armature/pose_transform.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c
    trunk/blender/source/blender/modifiers/intern/MOD_boolean_util.c
    trunk/blender/source/blender/modifiers/intern/MOD_warp.c

Modified: trunk/blender/source/blender/blenfont/BLF_api.h
===================================================================
--- trunk/blender/source/blender/blenfont/BLF_api.h	2013-08-07 03:30:23 UTC (rev 58980)
+++ trunk/blender/source/blender/blenfont/BLF_api.h	2013-08-07 03:36:05 UTC (rev 58981)
@@ -149,11 +149,11 @@
 /* Set the buffer, size and number of channels to draw, one thing to take care is call
  * this function with NULL pointer when we finish, for example:
  *
- *     BLF_buffer(my_fbuf, my_cbuf, 100, 100, 4, TRUE);
+ *     BLF_buffer(my_fbuf, my_cbuf, 100, 100, 4, TRUE, NULL);
  *
  *     ... set color, position and draw ...
  *
- *     BLF_buffer(NULL, NULL, 0, 0, 0, FALSE);
+ *     BLF_buffer(NULL, NULL, NULL, 0, 0, FALSE, NULL);
  */
 void BLF_buffer(int fontid, float *fbuf, unsigned char *cbuf, int w, int h, int nch, struct ColorManagedDisplay *display);
 

Modified: trunk/blender/source/blender/blenkernel/intern/dynamicpaint.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/dynamicpaint.c	2013-08-07 03:30:23 UTC (rev 58980)
+++ trunk/blender/source/blender/blenkernel/intern/dynamicpaint.c	2013-08-07 03:36:05 UTC (rev 58981)
@@ -3290,7 +3290,7 @@
 
 	if (!brush->dm) return 0;
 	{
-		BVHTreeFromMesh treeData = {0};
+		BVHTreeFromMesh treeData = {NULL};
 		float avg_brushNor[3] = {0.0f};
 		float brush_radius = brush->paint_distance * surface->radius_scale;
 		int numOfVerts;
@@ -4977,7 +4977,7 @@
 				/* make sure we're dealing with a brush	*/
 				if (pmd2->brush) {
 					DynamicPaintBrushSettings *brush = pmd2->brush;
-					BrushMaterials bMats = {0};
+					BrushMaterials bMats = {NULL};
 
 					/* calculate brush speed vectors if required */
 					if (surface->type == MOD_DPAINT_SURFACE_T_PAINT && brush->flags & MOD_DPAINT_DO_SMUDGE) {

Modified: trunk/blender/source/blender/blenkernel/intern/image_gen.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/image_gen.c	2013-08-07 03:30:23 UTC (rev 58980)
+++ trunk/blender/source/blender/blenkernel/intern/image_gen.c	2013-08-07 03:36:05 UTC (rev 58981)
@@ -336,7 +336,7 @@
 	}
 
 	/* cleanup the buffer. */
-	BLF_buffer(mono, NULL, NULL, 0, 0, 0, FALSE);
+	BLF_buffer(mono, NULL, NULL, 0, 0, 0, NULL);
 }
 
 void BKE_image_buf_fill_checker_color(unsigned char *rect, float *rect_float, int width, int height)

Modified: trunk/blender/source/blender/blenkernel/intern/smoke.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/smoke.c	2013-08-07 03:30:23 UTC (rev 58980)
+++ trunk/blender/source/blender/blenkernel/intern/smoke.c	2013-08-07 03:36:05 UTC (rev 58981)
@@ -722,7 +722,7 @@
 		DerivedMesh *dm = NULL;
 		MVert *mvert = NULL;
 		MFace *mface = NULL;
-		BVHTreeFromMesh treeData = {0};
+		BVHTreeFromMesh treeData = {NULL};
 		int numverts, i, z;
 
 		float surface_distance = 0.6;
@@ -1573,7 +1573,7 @@
 		MVert *mvert_orig = NULL;
 		MFace *mface = NULL;
 		MTFace *tface = NULL;
-		BVHTreeFromMesh treeData = {0};
+		BVHTreeFromMesh treeData = {NULL};
 		int numOfVerts, i, z;
 		float flow_center[3] = {0};
 
@@ -2108,7 +2108,7 @@
 				// float scene_subframe = scene->r.subframe;  // UNUSED
 				int subframe;
 				for (subframe = 0; subframe <= subframes; subframe++) {
-					EmissionMap em_temp = {0};
+					EmissionMap em_temp = {NULL};
 					float sample_size = 1.0f / (float)(subframes+1);
 					float prev_frame_pos = sample_size * (float)(subframe+1);
 					float sdt = dt * sample_size;

Modified: trunk/blender/source/blender/blenkernel/intern/tracking.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/tracking.c	2013-08-07 03:30:23 UTC (rev 58980)
+++ trunk/blender/source/blender/blenkernel/intern/tracking.c	2013-08-07 03:36:05 UTC (rev 58981)
@@ -654,7 +654,7 @@
  */
 int BKE_tracking_track_has_marker_at_frame(MovieTrackingTrack *track, int framenr)
 {
-	return BKE_tracking_marker_get_exact(track, framenr) != 0;
+	return BKE_tracking_marker_get_exact(track, framenr) != NULL;
 }
 
 /* Check whether track has got enabled marker at specified frame.

Modified: trunk/blender/source/blender/blenlib/intern/scanfill.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/scanfill.c	2013-08-07 03:30:23 UTC (rev 58980)
+++ trunk/blender/source/blender/blenlib/intern/scanfill.c	2013-08-07 03:36:05 UTC (rev 58981)
@@ -379,10 +379,10 @@
 	sc = (ScanFillVertLink *)bsearch(&scsearch, sf_ctx->_scdata, len,
 	                                 sizeof(ScanFillVertLink), vergscdata);
 
-	if (sc == 0) printf("Error in search edge: %p\n", (void *)eed);
+	if (sc == NULL) printf("Error in search edge: %p\n", (void *)eed);
 	else if (addedgetoscanvert(sc, eed) == 0) return sc;
 
-	return 0;
+	return NULL;
 }
 
 static short boundinsideEV(ScanFillEdge *eed, ScanFillVert *eve)
@@ -669,7 +669,7 @@
 				a = verts;
 				break;
 			}
-			if (ed2 == 0) {
+			if (ed2 == NULL) {
 				sc->edge_first = sc->edge_last = NULL;
 				/* printf("just 1 edge to vert\n"); */
 				BLI_addtail(&sf_ctx->filledgebase, ed1);
@@ -1051,7 +1051,7 @@
 			eed = nexted;
 		}
 	}
-	if (sf_ctx->filledgebase.first == 0) {
+	if (sf_ctx->filledgebase.first == NULL) {
 		/* printf("All edges removed\n"); */
 		return 0;
 	}

Modified: trunk/blender/source/blender/blenlib/intern/voronoi.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/voronoi.c	2013-08-07 03:30:23 UTC (rev 58980)
+++ trunk/blender/source/blender/blenlib/intern/voronoi.c	2013-08-07 03:36:05 UTC (rev 58981)
@@ -121,7 +121,7 @@
 	parabola->is_leaf = FALSE;
 	parabola->event = NULL;
 	parabola->edge = NULL;
-	parabola->parent = 0;
+	parabola->parent = NULL;
 
 	return parabola;
 }
@@ -134,7 +134,7 @@
 	parabola->is_leaf = TRUE;
 	parabola->event = NULL;
 	parabola->edge = NULL;
-	parabola->parent = 0;
+	parabola->parent = NULL;
 
 	return parabola;
 }

Modified: trunk/blender/source/blender/editors/animation/keyframes_draw.c
===================================================================
--- trunk/blender/source/blender/editors/animation/keyframes_draw.c	2013-08-07 03:30:23 UTC (rev 58980)
+++ trunk/blender/source/blender/editors/animation/keyframes_draw.c	2013-08-07 03:36:05 UTC (rev 58981)
@@ -793,7 +793,7 @@
 {
 	DLRBT_Tree keys, blocks;
 	
-	short locked = (act && act->id.lib != 0);
+	short locked = (act && act->id.lib != NULL);
 	
 	BLI_dlrbTree_init(&keys);
 	BLI_dlrbTree_init(&blocks);
@@ -887,7 +887,7 @@
 	bAnimListElem *ale;
 	int filter;
 	
-	bAnimListElem dummychan = {0};
+	bAnimListElem dummychan = {NULL};
 	
 	if (sce == NULL)
 		return;
@@ -920,8 +920,8 @@
 	bAnimListElem *ale;
 	int filter;
 	
-	bAnimListElem dummychan = {0};
-	Base dummybase = {0};
+	bAnimListElem dummychan = {NULL};
+	Base dummybase = {NULL};
 	
 	if (ob == NULL)
 		return;

Modified: trunk/blender/source/blender/editors/armature/pose_transform.c
===================================================================
--- trunk/blender/source/blender/editors/armature/pose_transform.c	2013-08-07 03:30:23 UTC (rev 58980)
+++ trunk/blender/source/blender/editors/armature/pose_transform.c	2013-08-07 03:36:05 UTC (rev 58981)
@@ -815,7 +815,7 @@
 		 * just pose values should change, so this should be fine 
 		 */
 		bPose *dummyPose = NULL;
-		Object workob = {{0}};
+		Object workob = {{NULL}};
 		bPoseChannel *pchan;
 		
 		/* execute animation step for current frame using a dummy copy of the pose */

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c	2013-08-07 03:30:23 UTC (rev 58980)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_vertex.c	2013-08-07 03:36:05 UTC (rev 58981)
@@ -3364,7 +3364,7 @@
 	const bool is_interactive = (gesture != NULL);
 	DerivedMesh *dm = mesh_get_derived_final(scene, ob, scene->customdata_mask);
 
-	DMGradient_userData data = {0};
+	DMGradient_userData data = {NULL};
 
 	if (is_interactive) {
 		if (gesture->userdata == NULL) {

Modified: trunk/blender/source/blender/modifiers/intern/MOD_boolean_util.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_boolean_util.c	2013-08-07 03:30:23 UTC (rev 58980)
+++ trunk/blender/source/blender/modifiers/intern/MOD_boolean_util.c	2013-08-07 03:36:05 UTC (rev 58981)
@@ -519,8 +519,8 @@
 
 	DerivedMesh *result = NULL;
 
-	if (dm == NULL || dm_select == NULL) return 0;
-	if (!dm->getNumTessFaces(dm) || !dm_select->getNumTessFaces(dm_select)) return 0;
+	if (dm == NULL || dm_select == NULL) return NULL;
+	if (!dm->getNumTessFaces(dm) || !dm_select->getNumTessFaces(dm_select)) return NULL;
 
 	/* we map the final object back into ob's local coordinate space. For this
 	 * we need to compute the inverse transform from global to ob (inv_mat),

Modified: trunk/blender/source/blender/modifiers/intern/MOD_warp.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_warp.c	2013-08-07 03:30:23 UTC (rev 58980)
+++ trunk/blender/source/blender/modifiers/intern/MOD_warp.c	2013-08-07 03:36:05 UTC (rev 58981)
@@ -368,8 +368,8 @@
 	/* deformMatrices */    NULL,
 	/* deformVertsEM */     deformVertsEM,
 	/* deformMatricesEM */  NULL,
-	/* applyModifier */     0,
-	/* applyModifierEM */   0,
+	/* applyModifier */     NULL,
+	/* applyModifierEM */   NULL,
 	/* initData */          initData,
 	/* requiredDataMask */  requiredDataMask,
 	/* freeData */          freeData,




More information about the Bf-blender-cvs mailing list