OSDN Git Service

drmSL: Fix neighbor lookup
authorJan Vesely <jan.vesely@rutgers.edu>
Fri, 27 Feb 2015 17:20:32 +0000 (12:20 -0500)
committerJan Vesely <jan.vesely@rutgers.edu>
Sat, 4 Apr 2015 17:41:26 +0000 (13:41 -0400)
Commit e4a519635f75bde38aeb5b09f2ff4efbf73453e9:
    Tidy up compile warnings by cleaning up types.

removed call to SLLocate which gutted the function of all functionality.
This patch restores the original behavior, with an additional fix
that zeros the update array in case SLLocate bails early.

v2: zero the update array instead of checking the return value.
    SLLocate returns NULL both on failure and if the element is greater
    than everything in the list
v3: Improve commit message

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
xf86drmSL.c

index acddb54..cf588ac 100644 (file)
@@ -264,12 +264,14 @@ int drmSLLookupNeighbors(void *l, unsigned long key,
                         unsigned long *next_key, void **next_value)
 {
     SkipListPtr   list = (SkipListPtr)l;
-    SLEntryPtr    update[SL_MAX_LEVEL + 1];
+    SLEntryPtr    update[SL_MAX_LEVEL + 1] = {0};
     int           retcode = 0;
 
+    SLLocate(list, key, update);
+
     *prev_key   = *next_key   = key;
     *prev_value = *next_value = NULL;
-       
+
     if (update[0]) {
        *prev_key   = update[0]->key;
        *prev_value = update[0]->value;