[Bf-blender-cvs] [e6258f09d5d] profiler-editor: replace macros with inline functions

Jacques Lucke noreply at git.blender.org
Thu Apr 29 11:30:50 CEST 2021


Commit: e6258f09d5d0a6f899d8dc1307251b71a3116bde
Author: Jacques Lucke
Date:   Thu Apr 29 10:30:33 2021 +0200
Branches: profiler-editor
https://developer.blender.org/rBe6258f09d5d0a6f899d8dc1307251b71a3116bde

replace macros with inline functions

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

M	source/blender/blenlib/BLI_profile.h

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

diff --git a/source/blender/blenlib/BLI_profile.h b/source/blender/blenlib/BLI_profile.h
index f1cbac7b3f7..d5929dcae08 100644
--- a/source/blender/blenlib/BLI_profile.h
+++ b/source/blender/blenlib/BLI_profile.h
@@ -41,29 +41,34 @@ void _bli_profile_task_begin_subtask(BLI_ProfileTask *task,
                                      const BLI_ProfileTask *parent_task);
 void _bli_profile_task_end(BLI_ProfileTask *task);
 
-#define BLI_profile_task_begin(task_ptr, name) \
-  if (bli_profiling_is_enabled) { \
-    _bli_profile_task_begin((task_ptr), (name)); \
-  } \
-  else { \
-    (task_ptr)->id = BLI_PROFILE_DUMMY_ID; \
-  } \
-  ((void)0)
+BLI_INLINE void BLI_profile_task_begin(BLI_ProfileTask *task, const char *name)
+{
+  if (bli_profiling_is_enabled) {
+    _bli_profile_task_begin(task, name);
+  }
+  else {
+    task->id = BLI_PROFILE_DUMMY_ID;
+  }
+}
 
-#define BLI_profile_task_begin_subtask(task_ptr, name, parent_task) \
-  if (bli_profiling_is_enabled) { \
-    _bli_profile_task_begin_subtask((task_ptr), (name), (parent_task)); \
-  } \
-  else { \
-    (task_ptr)->id = BLI_PROFILE_DUMMY_ID; \
-  } \
-  ((void)0)
+BLI_INLINE void BLI_profile_task_begin_subtask(BLI_ProfileTask *task,
+                                               const char *name,
+                                               const BLI_ProfileTask *parent_task)
+{
+  if (bli_profiling_is_enabled) {
+    _bli_profile_task_begin_subtask(task, name, parent_task);
+  }
+  else {
+    task->id = BLI_PROFILE_DUMMY_ID;
+  }
+}
 
-#define BLI_profile_task_end(task_ptr) \
-  if ((task_ptr)->id != BLI_PROFILE_DUMMY_ID) { \
-    _bli_profile_task_end(task_ptr); \
-  } \
-  ((void)0)
+BLI_INLINE void BLI_profile_task_end(BLI_ProfileTask *task)
+{
+  if (task->id != BLI_PROFILE_DUMMY_ID) {
+    _bli_profile_task_end(task);
+  }
+}
 
 #ifdef __cplusplus
 }



More information about the Bf-blender-cvs mailing list