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

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