[Bf-blender-cvs] [f98eedb] soc-2013-depsgraph_mt: Code cleanup

Sergey Sharybin noreply at git.blender.org
Wed Dec 11 11:28:26 CET 2013


Commit: f98eedb86b7a4a5a0dbd8a84f049cfbdb02142e7
Author: Sergey Sharybin
Date:   Tue Dec 10 14:37:46 2013 +0600
http://developer.blender.org/rBf98eedb86b7a4a5a0dbd8a84f049cfbdb02142e7

Code cleanup

- Add some additional cases to mallocn_intern
  to cover FreeBSD and add missing include for OSX.

- Move DAG_init/DAG_exit functions to the top,
  they're kind of global and it's not so much
  logical to keep them under "Threaded Update"
  comment.

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

M	intern/guardedalloc/intern/mallocn_intern.h
M	source/blender/blenkernel/BKE_depsgraph.h
M	source/blender/blenkernel/BKE_displist.h
M	source/blender/blenkernel/intern/depsgraph.c

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

diff --git a/intern/guardedalloc/intern/mallocn_intern.h b/intern/guardedalloc/intern/mallocn_intern.h
index cf77ce6..db45b59 100644
--- a/intern/guardedalloc/intern/mallocn_intern.h
+++ b/intern/guardedalloc/intern/mallocn_intern.h
@@ -54,7 +54,10 @@
 #if defined(__linux__)
 #  include <malloc.h>
 #  define HAVE_MALLOC_STATS
+#elif defined(__FreeBSD__)
+#  include <malloc_np.h>
 #elif defined(__APPLE__)
+#  include <malloc/malloc.h>
 #  define malloc_usable_size malloc_size
 #elif defined(WIN32)
 #  include <malloc.h>
diff --git a/source/blender/blenkernel/BKE_depsgraph.h b/source/blender/blenkernel/BKE_depsgraph.h
index 592baa7..be5ae7f 100644
--- a/source/blender/blenkernel/BKE_depsgraph.h
+++ b/source/blender/blenkernel/BKE_depsgraph.h
@@ -60,6 +60,10 @@ typedef struct EvaluationContext {
 	                     keep at false if update shall happen for the viewport. */
 } EvaluationContext;
 
+/* Global initialization/deinitialization */
+void DAG_init(void);
+void DAG_exit(void);
+
 /* Build and Update
  *
  * DAG_scene_relations_update will rebuild the dependency graph for a given
@@ -128,10 +132,6 @@ void DAG_editors_update_cb(void (*id_func)(struct Main *bmain, struct ID *id),
 
 /* ** Threaded update ** */
 
-/* Global initialization/deinitialization */
-void DAG_init(void);
-void DAG_exit(void);
-
 /* Initialize the DAG for threaded update. */
 void DAG_threaded_update_begin(struct Scene *scene,
                                void (*func)(void *node, void *user_data),
diff --git a/source/blender/blenkernel/BKE_displist.h b/source/blender/blenkernel/BKE_displist.h
index e82d3db..2178f86 100644
--- a/source/blender/blenkernel/BKE_displist.h
+++ b/source/blender/blenkernel/BKE_displist.h
@@ -28,8 +28,6 @@
 #ifndef __BKE_DISPLIST_H__
 #define __BKE_DISPLIST_H__
 
-struct ListBase;
-
 /** \file BKE_displist.h
  *  \ingroup bke
  *  \brief display list (or rather multi purpose list) stuff.
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index ff0cbbf..8074d6b 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -82,7 +82,19 @@
 #include "atomic_ops.h"
 
 #include "depsgraph_private.h"
- 
+
+static SpinLock threaded_update_lock;
+
+void DAG_init(void)
+{
+	BLI_spin_init(&threaded_update_lock);
+}
+
+void DAG_exit(void)
+{
+	BLI_spin_end(&threaded_update_lock);
+}
+
 /* Queue and stack operations for dag traversal 
  *
  * the queue store a list of freenodes to avoid successive alloc/dealloc
@@ -2710,18 +2722,6 @@ void DAG_pose_sort(Object *ob)
 
 /* ************************  DAG FOR THREADED UPDATE  ********************* */
 
-static SpinLock threaded_update_lock;
-
-void DAG_init(void)
-{
-	BLI_spin_init(&threaded_update_lock);
-}
-
-void DAG_exit(void)
-{
-	BLI_spin_end(&threaded_update_lock);
-}
-
 /* Initialize run-time data in the graph needed for traversing it
  * from multiple threads and start threaded tree traversal by adding
  * the root node to the queue.




More information about the Bf-blender-cvs mailing list