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

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