Kdrive/evdev internals

Grigory Batalov gbatalov at crystals.ru
Wed Apr 13 06:15:17 PDT 2011


Hello!

I'm afraid I can't understand Kdrive's evdev code (see
hw/kdrive/linux/evdev.c, line 98 or http://snipt.org/wpoph )
Why are there an inner and an outer 'for' cycles in EvdevPtrMotion()?

   for (i = 0; i <= ke->max_rel; i++)
        if (ke->rel[i])
        {
            int a;
            for (a = 0; a <= ke->max_rel; a++)
            {
...
            }
            break;
        }

They look the same, just inner cycle with the 'a' iterator lunches on the first
non-zero ke->rel[i] value and then the outer one breaks.
The 'i' variable isn't used in the inner cycle at all!

And what is 'if (ke->rel[i])' for, at last? The inner cycle doesn't check for
zero values.

P.S. If I use the wrong mailing list, please, point me to right one.



More information about the xorg mailing list