xserver: Branch 'master' - 2 commits

Daniel Stone daniels at kemper.freedesktop.org
Wed Mar 21 02:07:51 EET 2007


 xkb/XKBMAlloc.c |    2 +-
 xkb/xkbUtils.c  |    7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

New commits:
diff-tree f292de2ef13dc994a38029cee9e2642576893332 (from f34b9a20b0181d3c2641c305e91180711afbd4b9)
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Wed Mar 21 02:04:12 2007 +0200

    XKB: Fix size_syms calculation bug
    
    Apparently it needed to be nSyms*15/10, not *12/10; make it match the
    other allocation code.

diff --git a/xkb/XKBMAlloc.c b/xkb/XKBMAlloc.c
index 4b7428b..9feaf8e 100644
--- a/xkb/XKBMAlloc.c
+++ b/xkb/XKBMAlloc.c
@@ -399,7 +399,7 @@ KeyCode		matchingKeys[XkbMaxKeyCount],nM
 	}
 	if (nResize>0) {
 	    int nextMatch;
-	    xkb->map->size_syms= (nTotal*12)/10;
+	    xkb->map->size_syms= (nTotal*15)/10;
 	    newSyms = _XkbTypedCalloc(xkb->map->size_syms,KeySym);
 	    if (newSyms==NULL)
 		return BadAlloc;
diff-tree f34b9a20b0181d3c2641c305e91180711afbd4b9 (from 021fc5cb2cb4a7972b4a6fcb570c1da92787d68d)
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Wed Mar 21 02:03:37 2007 +0200

    XKB: Be a tiny bit more conservative with type allocation
    
    Make sure size_types will _always_ be 0 if we don't have any types.

diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c
index 1d23667..bb6d8a0 100644
--- a/xkb/xkbUtils.c
+++ b/xkb/xkbUtils.c
@@ -1140,6 +1140,9 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr
                     dtype->preserve = NULL;
                 }
             }
+
+            dst->map->size_types = src->map->num_types;
+            dst->map->num_types = src->map->num_types;
         }
         else {
             if (dst->map->types) {
@@ -1155,9 +1158,9 @@ XkbCopyKeymap(XkbDescPtr src, XkbDescPtr
                 xfree(dst->map->types);
                 dst->map->types = NULL;
             }
+            dst->map->num_types = 0;
+            dst->map->size_types = 0;
         }
-        dst->map->size_types = src->map->num_types;
-        dst->map->num_types = src->map->num_types;
 
         if (src->map->modmap) {
             if (src->max_key_code != dst->max_key_code) {



More information about the xorg-commit mailing list