aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Vesely2015-02-27 11:20:32 -0600
committerJan Vesely2015-04-04 12:41:26 -0500
commit3b2ee2b5bfc0d68525fee936e51297a9b6c629f1 (patch)
tree4b29fea9714746239648763b1f1a9f78be66101d /xf86drmSL.c
parentbc6b5174d362a01f6d638a4db6aaf2fd355db69c (diff)
downloadexternal-libdrm-3b2ee2b5bfc0d68525fee936e51297a9b6c629f1.tar.gz
external-libdrm-3b2ee2b5bfc0d68525fee936e51297a9b6c629f1.tar.xz
external-libdrm-3b2ee2b5bfc0d68525fee936e51297a9b6c629f1.zip
drmSL: Fix neighbor lookup
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>
Diffstat (limited to 'xf86drmSL.c')
-rw-r--r--xf86drmSL.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/xf86drmSL.c b/xf86drmSL.c
index acddb541..cf588ac9 100644
--- a/xf86drmSL.c
+++ b/xf86drmSL.c
@@ -264,12 +264,14 @@ int drmSLLookupNeighbors(void *l, unsigned long key,
264 unsigned long *next_key, void **next_value) 264 unsigned long *next_key, void **next_value)
265{ 265{
266 SkipListPtr list = (SkipListPtr)l; 266 SkipListPtr list = (SkipListPtr)l;
267 SLEntryPtr update[SL_MAX_LEVEL + 1]; 267 SLEntryPtr update[SL_MAX_LEVEL + 1] = {0};
268 int retcode = 0; 268 int retcode = 0;
269 269
270 SLLocate(list, key, update);
271
270 *prev_key = *next_key = key; 272 *prev_key = *next_key = key;
271 *prev_value = *next_value = NULL; 273 *prev_value = *next_value = NULL;
272 274
273 if (update[0]) { 275 if (update[0]) {
274 *prev_key = update[0]->key; 276 *prev_key = update[0]->key;
275 *prev_value = update[0]->value; 277 *prev_value = update[0]->value;