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

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