On Thu, 2010-02-04 at 19:48 -0500, Kristian Høgsberg wrote: > On Thu, Feb 4, 2010 at 2:23 PM, Matthew W. S. Bell > > Additionally, the function libdrm/xf86drmSL.c:drmSLLookupNeighbors() > > appears to be completely broken as it computes on the variable update > > which is unconditionally undefined. > > Yeah, nothing really uses the skip list and I'd like to drop it and > the hash table. I guess it's not a big deal though...
Well, it's a small function that's part of a public API, it should either do something other than return undefined results or be removed. As such, here is a patch removing it. Also attached is a patch for another warning fix. Matthew W.S. Bell
From 3203bcbae14611fa4c3df8b1c9fe81a738991814 Mon Sep 17 00:00:00 2001 From: Matthew W. S. Bell <matt...@bells23.org.uk> Date: Sat, 6 Feb 2010 04:10:31 +0000 Subject: [PATCH 1/2] Cast type for printf to silence warning. --- tests/drmstat.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/tests/drmstat.c b/tests/drmstat.c index 345b8d2..ea9d12f 100644 --- a/tests/drmstat.c +++ b/tests/drmstat.c @@ -288,7 +288,7 @@ int main(int argc, char **argv) drmError(r, argv[0]); return 1; } - printf("0x%04lx byte shm added at 0x%08lx\n", size, handle); + printf("0x%04lx byte shm added at 0x%08lx\n", size, (unsigned long)handle); sprintf(buf, "cat /proc/dri/0/vm"); system(buf); break; -- 1.6.5
From 04c7443cc7f16578c00d45617c91b51c26bdec17 Mon Sep 17 00:00:00 2001 From: Matthew W. S. Bell <matt...@bells23.org.uk> Date: Sat, 6 Feb 2010 04:11:02 +0000 Subject: [PATCH 2/2] Eliminate drmSLLookupNeighbors as it appears to want an SLLocateNeighbors function that never existed. --- xf86drm.h | 3 --- xf86drmSL.c | 51 --------------------------------------------------- 2 files changed, 0 insertions(+), 54 deletions(-) diff --git a/xf86drm.h b/xf86drm.h index 9b89f56..9cec066 100644 --- a/xf86drm.h +++ b/xf86drm.h @@ -682,9 +682,6 @@ extern int drmSLDelete(void *l, unsigned long key); extern int drmSLNext(void *l, unsigned long *key, void **value); extern int drmSLFirst(void *l, unsigned long *key, void **value); extern void drmSLDump(void *l); -extern int drmSLLookupNeighbors(void *l, unsigned long key, - unsigned long *prev_key, void **prev_value, - unsigned long *next_key, void **next_value); extern int drmOpenOnce(void *unused, const char *BusID, int *newlyopened); extern void drmCloseOnce(int fd); diff --git a/xf86drmSL.c b/xf86drmSL.c index acddb54..f3328de 100644 --- a/xf86drmSL.c +++ b/xf86drmSL.c @@ -96,9 +96,6 @@ extern int drmSLDelete(void *l, unsigned long key); extern int drmSLNext(void *l, unsigned long *key, void **value); extern int drmSLFirst(void *l, unsigned long *key, void **value); extern void drmSLDump(void *l); -extern int drmSLLookupNeighbors(void *l, unsigned long key, - unsigned long *prev_key, void **prev_value, - unsigned long *next_key, void **next_value); #endif static SLEntryPtr SLCreateEntry(int max_level, unsigned long key, void *value) @@ -259,30 +256,6 @@ int drmSLLookup(void *l, unsigned long key, void **value) return -1; } -int drmSLLookupNeighbors(void *l, unsigned long key, - unsigned long *prev_key, void **prev_value, - unsigned long *next_key, void **next_value) -{ - SkipListPtr list = (SkipListPtr)l; - SLEntryPtr update[SL_MAX_LEVEL + 1]; - int retcode = 0; - - *prev_key = *next_key = key; - *prev_value = *next_value = NULL; - - if (update[0]) { - *prev_key = update[0]->key; - *prev_value = update[0]->value; - ++retcode; - if (update[0]->forward[0]) { - *next_key = update[0]->forward[0]->key; - *next_value = update[0]->forward[0]->value; - ++retcode; - } - } - return retcode; -} - int drmSLNext(void *l, unsigned long *key, void **value) { SkipListPtr list = (SkipListPtr)l; @@ -410,21 +383,6 @@ static double do_time(int size, int iter) return usec; } -static void print_neighbors(void *list, unsigned long key) -{ - unsigned long prev_key = 0; - unsigned long next_key = 0; - void *prev_value; - void *next_value; - int retval; - - retval = drmSLLookupNeighbors(list, key, - &prev_key, &prev_value, - &next_key, &next_value); - printf("Neighbors of %5lu: %d %5lu %5lu\n", - key, retval, prev_key, next_key); -} - int main(void) { SkipListPtr list; @@ -442,15 +400,6 @@ int main(void) print(list); printf("\n==============================\n\n"); - print_neighbors(list, 0); - print_neighbors(list, 50); - print_neighbors(list, 51); - print_neighbors(list, 123); - print_neighbors(list, 200); - print_neighbors(list, 213); - print_neighbors(list, 256); - printf("\n==============================\n\n"); - drmSLDelete(list, 50); print(list); printf("\n==============================\n\n"); -- 1.6.5
signature.asc
Description: This is a digitally signed message part
------------------------------------------------------------------------------ The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com
-- _______________________________________________ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel