[Bf-blender-cvs] [7d467915a46] master: Cleanup: Decrease variable scope

Hans Goudey noreply at git.blender.org
Tue Mar 30 01:48:41 CEST 2021


Commit: 7d467915a461d003daf26bb9f82afa2e93d4b8ea
Author: Hans Goudey
Date:   Mon Mar 29 18:48:34 2021 -0500
Branches: master
https://developer.blender.org/rB7d467915a461d003daf26bb9f82afa2e93d4b8ea

Cleanup: Decrease variable scope

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

M	source/blender/editors/interface/interface_panel.c

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

diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 7343417137a..8922babc9b8 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -2529,9 +2529,8 @@ PointerRNA *UI_region_panel_custom_data_under_cursor(const bContext *C, const wm
 {
   ARegion *region = CTX_wm_region(C);
 
-  Panel *panel = NULL;
   LISTBASE_FOREACH (uiBlock *, block, &region->uiblocks) {
-    panel = block->panel;
+    Panel *panel = block->panel;
     if (panel == NULL) {
       continue;
     }
@@ -2541,15 +2540,11 @@ PointerRNA *UI_region_panel_custom_data_under_cursor(const bContext *C, const wm
     ui_window_to_block(region, block, &mx, &my);
     const int mouse_state = ui_panel_mouse_state_get(block, panel, mx, my);
     if (ELEM(mouse_state, PANEL_MOUSE_INSIDE_CONTENT, PANEL_MOUSE_INSIDE_HEADER)) {
-      break;
+      return UI_panel_custom_data_get(panel);
     }
   }
 
-  if (panel == NULL) {
-    return NULL;
-  }
-
-  return UI_panel_custom_data_get(panel);
+  return NULL;
 }
 
 /** \} */



More information about the Bf-blender-cvs mailing list