[Bf-blender-cvs] [4115229637c] master: Cleanup: Use shorthand variables

Hans Goudey noreply at git.blender.org
Sat Sep 19 23:25:36 CEST 2020


Commit: 4115229637c0acdcffbaceae282ccd854bfdb1c8
Author: Hans Goudey
Date:   Sat Sep 19 16:24:10 2020 -0500
Branches: master
https://developer.blender.org/rB4115229637c0acdcffbaceae282ccd854bfdb1c8

Cleanup: Use shorthand variables

We don't use the other variables in the sorting struct,
so we might as well use the panels directly.

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

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 5800479874c..a2b9f388759 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -1653,53 +1653,55 @@ bool UI_panel_is_dragging(const struct Panel *panel)
 }
 
 /**
- * \note about sorting;
- * the #Panel.sortorder has a lower value for new panels being added.
+ * \note about sorting:
+ * The #Panel.sortorder has a lower value for new panels being added.
  * however, that only works to insert a single panel, when more new panels get
  * added the coordinates of existing panels and the previously stored to-be-inserted
- * panels do not match for sorting
+ * panels do not match for sorting.
  */
 
-static int find_highest_panel(const void *a1, const void *a2)
+static int find_highest_panel(const void *a, const void *b)
 {
-  const PanelSort *ps1 = a1, *ps2 = a2;
+  const Panel *panel_a = ((PanelSort *)a)->panel;
+  const Panel *panel_b = ((PanelSort *)b)->panel;
 
-  /* stick uppermost header-less panels to the top of the region -
-   * prevent them from being sorted (multiple header-less panels have to be sorted though) */
-  if (ps1->panel->type->flag & PNL_NO_HEADER && ps2->panel->type->flag & PNL_NO_HEADER) {
+  /* Stick uppermost header-less panels to the top of the region -
+   * prevent them from being sorted (multiple header-less panels have to be sorted though). */
+  if (panel_a->type->flag & PNL_NO_HEADER && panel_b->type->flag & PNL_NO_HEADER) {
     /* Skip and check for `ofsy` and #Panel.sortorder below. */
   }
-  if (ps1->panel->type->flag & PNL_NO_HEADER) {
+  if (panel_a->type->flag & PNL_NO_HEADER) {
     return -1;
   }
-  if (ps2->panel->type->flag & PNL_NO_HEADER) {
+  if (panel_a->type->flag & PNL_NO_HEADER) {
     return 1;
   }
 
-  if (ps1->panel->ofsy + ps1->panel->sizey < ps2->panel->ofsy + ps2->panel->sizey) {
+  if (panel_a->ofsy + panel_a->sizey < panel_b->ofsy + panel_b->sizey) {
     return 1;
   }
-  if (ps1->panel->ofsy + ps1->panel->sizey > ps2->panel->ofsy + ps2->panel->sizey) {
+  if (panel_a->ofsy + panel_a->sizey > panel_b->ofsy + panel_b->sizey) {
     return -1;
   }
-  if (ps1->panel->sortorder > ps2->panel->sortorder) {
+  if (panel_a->sortorder > panel_b->sortorder) {
     return 1;
   }
-  if (ps1->panel->sortorder < ps2->panel->sortorder) {
+  if (panel_a->sortorder < panel_b->sortorder) {
     return -1;
   }
 
   return 0;
 }
 
-static int compare_panel(const void *a1, const void *a2)
+static int compare_panel(const void *a, const void *b)
 {
-  const PanelSort *ps1 = a1, *ps2 = a2;
+  const Panel *panel_a = ((PanelSort *)a)->panel;
+  const Panel *panel_b = ((PanelSort *)b)->panel;
 
-  if (ps1->panel->sortorder > ps2->panel->sortorder) {
+  if (panel_a->sortorder > panel_b->sortorder) {
     return 1;
   }
-  if (ps1->panel->sortorder < ps2->panel->sortorder) {
+  if (panel_a->sortorder < panel_b->sortorder) {
     return -1;
   }



More information about the Bf-blender-cvs mailing list