[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53312] trunk/blender/source/blender: code cleanup: don't alloca zero size and remove paranoid NULL checks ( checked all uses and there not needed).

Campbell Barton ideasman42 at gmail.com
Mon Dec 24 15:59:15 CET 2012


Revision: 53312
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53312
Author:   campbellbarton
Date:     2012-12-24 14:59:15 +0000 (Mon, 24 Dec 2012)
Log Message:
-----------
code cleanup: don't alloca zero size and remove paranoid NULL checks (checked all uses and there not needed).

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/BLI_path_util.h
    trunk/blender/source/blender/blenlib/intern/path_util.c
    trunk/blender/source/blender/bmesh/intern/bmesh_interp.c

Modified: trunk/blender/source/blender/blenlib/BLI_path_util.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_path_util.h	2012-12-24 14:21:14 UTC (rev 53311)
+++ trunk/blender/source/blender/blenlib/BLI_path_util.h	2012-12-24 14:59:15 UTC (rev 53312)
@@ -120,7 +120,11 @@
 void BLI_splitdirstring(char *di, char *fi);
 
 /* make sure path separators conform to system one */
-void BLI_clean(char *path);
+void BLI_clean(char *path)
+#ifdef __GNUC__
+__attribute__((nonnull(1)))
+#endif
+;
 
 /**
  * dir can be any input, like from buttons, and this function
@@ -173,7 +177,11 @@
  * \a from The character to replace
  * \a to The character to replace with
  */
-void BLI_char_switch(char *string, char from, char to);
+void BLI_char_switch(char *string, char from, char to)
+#ifdef __GNUC__
+__attribute__((nonnull(1)))
+#endif
+;
 
 /* Initialize path to program executable */
 void BLI_init_program_path(const char *argv0);

Modified: trunk/blender/source/blender/blenlib/intern/path_util.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/path_util.c	2012-12-24 14:21:14 UTC (rev 53311)
+++ trunk/blender/source/blender/blenlib/intern/path_util.c	2012-12-24 14:59:15 UTC (rev 53312)
@@ -1212,8 +1212,6 @@
 
 void BLI_clean(char *path)
 {
-	if (path == NULL) return;
-
 #ifdef WIN32
 	if (path && BLI_strnlen(path, 3) > 2) {
 		BLI_char_switch(path + 2, '/', '\\');
@@ -1225,7 +1223,6 @@
 
 void BLI_char_switch(char *string, char from, char to) 
 {
-	if (string == NULL) return;
 	while (*string != 0) {
 		if (*string == from) *string = to;
 		string++;

Modified: trunk/blender/source/blender/bmesh/intern/bmesh_interp.c
===================================================================
--- trunk/blender/source/blender/bmesh/intern/bmesh_interp.c	2012-12-24 14:21:14 UTC (rev 53311)
+++ trunk/blender/source/blender/bmesh/intern/bmesh_interp.c	2012-12-24 14:59:15 UTC (rev 53312)
@@ -603,7 +603,7 @@
 {
 	BMLoop *l_iter;
 	BMLoop *l_first;
-	void **vblocks  = BLI_array_alloca(vblocks, do_vertex ? source->len : 0);
+	void **vblocks  = do_vertex ? BLI_array_alloca(vblocks, source->len) : NULL;
 	void **blocks   = BLI_array_alloca(blocks,  source->len);
 	float (*cos)[3] = BLI_array_alloca(cos,     source->len);
 	float *w        = BLI_array_alloca(w,       source->len);




More information about the Bf-blender-cvs mailing list