[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47080] trunk/blender/source: remove NULL check in TREESTORE macro, the return NULL value wasny checked for by any callers ( ie - it would crash later if the arg was NULL anyway)

Campbell Barton ideasman42 at gmail.com
Sun May 27 16:43:19 CEST 2012


Revision: 47080
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47080
Author:   campbellbarton
Date:     2012-05-27 14:43:18 +0000 (Sun, 27 May 2012)
Log Message:
-----------
remove NULL check in TREESTORE macro, the return NULL value wasny checked for by any callers (ie - it would crash later if the arg was NULL anyway)

also comment on the speed of check_persistent()

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_outliner/outliner_intern.h
    trunk/blender/source/blender/editors/space_outliner/outliner_tree.c
    trunk/blender/source/blenderplayer/CMakeLists.txt

Modified: trunk/blender/source/blender/editors/space_outliner/outliner_intern.h
===================================================================
--- trunk/blender/source/blender/editors/space_outliner/outliner_intern.h	2012-05-27 14:30:45 UTC (rev 47079)
+++ trunk/blender/source/blender/editors/space_outliner/outliner_intern.h	2012-05-27 14:43:18 UTC (rev 47080)
@@ -110,7 +110,7 @@
 /* get TreeStoreElem associated with a TreeElement 
  * < a: (TreeElement) tree element to find stored element for
  */
-#define TREESTORE(a) ((a) ? soops->treestore->data + (a)->store_index : NULL)
+#define TREESTORE(a) (soops->treestore->data + (a)->store_index)
 
 /* size constants */
 #define OL_Y_OFFSET 2

Modified: trunk/blender/source/blender/editors/space_outliner/outliner_tree.c
===================================================================
--- trunk/blender/source/blender/editors/space_outliner/outliner_tree.c	2012-05-27 14:30:45 UTC (rev 47079)
+++ trunk/blender/source/blender/editors/space_outliner/outliner_tree.c	2012-05-27 14:43:18 UTC (rev 47080)
@@ -132,6 +132,14 @@
 	}
 }
 
+/* XXX - THIS FUNCTION IS INCREDIBLY SLOW
+ * ... it can bring blenders tools and viewport to a grinding halt becuase of searching
+ * for duplicate items every times they are added.
+ *
+ * TODO (possible speedups)
+ * - use a hash for duplicate (could even store a hash per type)
+ * - use mempool for TreeElements
+ * */
 static void check_persistent(SpaceOops *soops, TreeElement *te, ID *id, short type, short nr)
 {
 	TreeStore *ts;
@@ -147,8 +155,8 @@
 	/* check if 'te' is in treestore */
 	tselem = ts->data;
 	for (a = 0; a < ts->usedelem; a++, tselem++) {
-		if (tselem->id == id && tselem->used == 0) {
-			if ((type == 0 && tselem->type == 0) || (tselem->type == type && tselem->nr == nr)) {
+		if ((tselem->used == 0) && (tselem->type == type) && (tselem->id == id)) {
+			if ((type == 0) || (tselem->nr == nr)) {
 				te->store_index = a;
 				tselem->used = 1;
 				return;

Modified: trunk/blender/source/blenderplayer/CMakeLists.txt
===================================================================
--- trunk/blender/source/blenderplayer/CMakeLists.txt	2012-05-27 14:30:45 UTC (rev 47079)
+++ trunk/blender/source/blenderplayer/CMakeLists.txt	2012-05-27 14:43:18 UTC (rev 47080)
@@ -1,4 +1,3 @@
-# -*- mode: cmake; indent-tabs-mode: t; -*-
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
 # This program is free software; you can redistribute it and/or




More information about the Bf-blender-cvs mailing list