QWindowsKeyMapper: use a more efficient data structure for 'keyLayout'
authorMarc Mutz <marc.mutz@kdab.com>
Wed, 10 Oct 2012 16:27:04 +0000 (18:27 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Tue, 16 Oct 2012 15:31:31 +0000 (17:31 +0200)
commitcd168110e0b9fbcba3f453de14131eb17c82109f
treeba89398d790c19574ca49e571b8c6640dad14872
parentcab891dc502f86cfc670d9facb2f9fa6708e9dd3
QWindowsKeyMapper: use a more efficient data structure for 'keyLayout'

Instead of allocating small chunks (40 bytes) on the heap, use a contiguous
array to hold them. This always occupies 10240 bytes of memory instead of
1024 (32 bits) or 2048 (64 bits) for the pointer array (plus heap memory
which depends on the number of items allocated), but is more cache-friendly
and uses less memory when the array isn't sparse.

To emulate the nullptr, a new bool has been added (doesn't change
sizeof(KeyboardLayoutItem)).

Also replace a few more magic numbers by symbolic constants.

Change-Id: I7160f600faddd63deea265c89dc6fd857c7b557f
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
src/plugins/platforms/windows/qwindowskeymapper.cpp
src/plugins/platforms/windows/qwindowskeymapper.h