[Bf-blender-cvs] [318a5cc4ba4] fcurve-modifier-panels: Use const, fix clang-tidy building

Hans Goudey noreply at git.blender.org
Mon Oct 19 04:45:01 CEST 2020


Commit: 318a5cc4ba4b853f7be6b4bbf727ffe322328e12
Author: Hans Goudey
Date:   Wed Aug 12 11:36:07 2020 -0400
Branches: fcurve-modifier-panels
https://developer.blender.org/rB318a5cc4ba4b853f7be6b4bbf727ffe322328e12

Use const, fix clang-tidy building

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

M	source/blender/editors/include/UI_interface.h
M	source/blender/editors/interface/interface_panel.c

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

diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index c02b4da3599..5d936cdfaa3 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -1715,7 +1715,7 @@ struct Panel *UI_panel_add_instanced(struct ScrArea *area,
                                      char *panel_idname,
                                      int list_index,
                                      struct PointerRNA *custom_data);
-void UI_panels_free_instanced(struct bContext *C, struct ARegion *region);
+void UI_panels_free_instanced(const struct bContext *C, struct ARegion *region);
 
 #define LIST_PANEL_UNIQUE_STR_LEN 4
 void UI_list_panel_unique_str(struct Panel *panel, char *r_name);
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 9b2b6a42db4..d334007a097 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -117,7 +117,9 @@ typedef struct PanelSort {
 static int get_panel_real_size_y(const Panel *panel);
 static void panel_activate_state(const bContext *C, Panel *panel, uiHandlePanelState state);
 static int compare_panel(const void *a1, const void *a2);
-static bool panel_type_context_poll(ARegion *region, PanelType *panel_type, const char *context);
+static bool panel_type_context_poll(ARegion *region,
+                                    const PanelType *panel_type,
+                                    const char *context);
 
 static void panel_title_color_get(bool show_background, uchar color[4])
 {
@@ -370,7 +372,7 @@ static void panel_delete(const bContext *C, ARegion *region, ListBase *panels, P
  * \note Can be called with NULL \a C, but it should be avoided because
  * handlers might not be removed.
  */
-void UI_panels_free_instanced(bContext *C, ARegion *region)
+void UI_panels_free_instanced(const bContext *C, ARegion *region)
 {
   /* Delete panels with the instanced flag. */
   LISTBASE_FOREACH_MUTABLE (Panel *, panel, &region->panels) {
@@ -460,7 +462,7 @@ static void reorder_instanced_panel_list(bContext *C, ARegion *region, Panel *dr
     return;
   }
 
-  char *context;
+  char *context = NULL;
   if (!UI_panel_category_is_visible(region)) {
     context = drag_panel->type->context;
   }
@@ -660,17 +662,19 @@ static void panels_collapse_all(const bContext *C,
   set_panels_list_data_expand_flag(C, region);
 }
 
-static bool panel_type_context_poll(ARegion *region, PanelType *panel_type, const char *context)
+static bool panel_type_context_poll(ARegion *region,
+                                    const PanelType *panel_type,
+                                    const char *context)
 {
   if (UI_panel_category_is_visible(region)) {
     return STREQ(panel_type->category, UI_panel_category_active_get(region, false));
   }
-  else {
-    if (panel_type->context[0] && STREQ(panel_type->context, context)) {
-      return true;
-    }
-    return false;
+
+  if (panel_type->context[0] && STREQ(panel_type->context, context)) {
+    return true;
   }
+
+  return false;
 }
 
 Panel *UI_panel_find_by_type(ListBase *lb, PanelType *pt)



More information about the Bf-blender-cvs mailing list