Blame SOURCES/0001-xkb-switch-to-array-index-loops-to-moving-pointers.patch

9c4717
From c9b379ec5a1a34692af06056925bd0fc5f809713 Mon Sep 17 00:00:00 2001
9c4717
From: Peter Hutterer <peter.hutterer@who-t.net>
9c4717
Date: Tue, 5 Jul 2022 12:40:47 +1000
9c4717
Subject: [PATCH xserver 1/3] xkb: switch to array index loops to moving
9c4717
 pointers
9c4717
9c4717
Most similar loops here use a pointer that advances with each loop
9c4717
iteration, let's do the same here for consistency.
9c4717
9c4717
No functional changes.
9c4717
9c4717
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
9c4717
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
9c4717
(cherry picked from commit f1070c01d616c5f21f939d5ebc533738779451ac)
9c4717
---
9c4717
 xkb/xkb.c | 20 ++++++++++----------
9c4717
 1 file changed, 10 insertions(+), 10 deletions(-)
9c4717
9c4717
diff --git a/xkb/xkb.c b/xkb/xkb.c
9c4717
index d056c698c..684394d77 100644
9c4717
--- a/xkb/xkb.c
9c4717
+++ b/xkb/xkb.c
9c4717
@@ -5372,16 +5372,16 @@ _CheckSetSections(XkbGeometryPtr geom,
9c4717
             row->left = rWire->left;
9c4717
             row->vertical = rWire->vertical;
9c4717
             kWire = (xkbKeyWireDesc *) &rWire[1];
9c4717
-            for (k = 0; k < rWire->nKeys; k++) {
9c4717
+            for (k = 0; k < rWire->nKeys; k++, kWire++) {
9c4717
                 XkbKeyPtr key;
9c4717
 
9c4717
                 key = XkbAddGeomKey(row);
9c4717
                 if (!key)
9c4717
                     return BadAlloc;
9c4717
-                memcpy(key->name.name, kWire[k].name, XkbKeyNameLength);
9c4717
-                key->gap = kWire[k].gap;
9c4717
-                key->shape_ndx = kWire[k].shapeNdx;
9c4717
-                key->color_ndx = kWire[k].colorNdx;
9c4717
+                memcpy(key->name.name, kWire->name, XkbKeyNameLength);
9c4717
+                key->gap = kWire->gap;
9c4717
+                key->shape_ndx = kWire->shapeNdx;
9c4717
+                key->color_ndx = kWire->colorNdx;
9c4717
                 if (key->shape_ndx >= geom->num_shapes) {
9c4717
                     client->errorValue = _XkbErrCode3(0x10, key->shape_ndx,
9c4717
                                                       geom->num_shapes);
9c4717
@@ -5393,7 +5393,7 @@ _CheckSetSections(XkbGeometryPtr geom,
9c4717
                     return BadMatch;
9c4717
                 }
9c4717
             }
9c4717
-            rWire = (xkbRowWireDesc *) &kWire[rWire->nKeys];
9c4717
+            rWire = (xkbRowWireDesc *)kWire;
9c4717
         }
9c4717
         wire = (char *) rWire;
9c4717
         if (sWire->nDoodads > 0) {
9c4717
@@ -5458,16 +5458,16 @@ _CheckSetShapes(XkbGeometryPtr geom,
9c4717
                     return BadAlloc;
9c4717
                 ol->corner_radius = olWire->cornerRadius;
9c4717
                 ptWire = (xkbPointWireDesc *) &olWire[1];
9c4717
-                for (p = 0, pt = ol->points; p < olWire->nPoints; p++, pt++) {
9c4717
-                    pt->x = ptWire[p].x;
9c4717
-                    pt->y = ptWire[p].y;
9c4717
+                for (p = 0, pt = ol->points; p < olWire->nPoints; p++, pt++, ptWire++) {
9c4717
+                    pt->x = ptWire->x;
9c4717
+                    pt->y = ptWire->y;
9c4717
                     if (client->swapped) {
9c4717
                         swaps(&pt->x);
9c4717
                         swaps(&pt->y);
9c4717
                     }
9c4717
                 }
9c4717
                 ol->num_points = olWire->nPoints;
9c4717
-                olWire = (xkbOutlineWireDesc *) (&ptWire[olWire->nPoints]);
9c4717
+                olWire = (xkbOutlineWireDesc *)ptWire;
9c4717
             }
9c4717
             if (shapeWire->primaryNdx != XkbNoShape)
9c4717
                 shape->primary = &shape->outlines[shapeWire->primaryNdx];
9c4717
-- 
9c4717
2.36.1
9c4717