• Home
  • Raw
  • Download

Lines Matching refs:list

134     SkipListPtr  list;  in drmSLCreate()  local
137 list = SL_ALLOC(sizeof(*list)); in drmSLCreate()
138 if (!list) return NULL; in drmSLCreate()
139 list->magic = SL_LIST_MAGIC; in drmSLCreate()
140 list->level = 0; in drmSLCreate()
141 list->head = SLCreateEntry(SL_MAX_LEVEL, 0, NULL); in drmSLCreate()
142 list->count = 0; in drmSLCreate()
144 for (i = 0; i <= SL_MAX_LEVEL; i++) list->head->forward[i] = NULL; in drmSLCreate()
146 return list; in drmSLCreate()
151 SkipListPtr list = (SkipListPtr)l; in drmSLDestroy() local
155 if (list->magic != SL_LIST_MAGIC) return -1; /* Bad magic */ in drmSLDestroy()
157 for (entry = list->head; entry; entry = next) { in drmSLDestroy()
164 list->magic = SL_FREED_MAGIC; in drmSLDestroy()
165 SL_FREE(list); in drmSLDestroy()
171 SkipListPtr list = (SkipListPtr)l; in SLLocate() local
175 if (list->magic != SL_LIST_MAGIC) return NULL; in SLLocate()
177 for (i = list->level, entry = list->head; i >= 0; i--) { in SLLocate()
188 SkipListPtr list = (SkipListPtr)l; in drmSLInsert() local
194 if (list->magic != SL_LIST_MAGIC) return -1; /* Bad magic */ in drmSLInsert()
196 entry = SLLocate(list, key, update); in drmSLInsert()
202 if (level > list->level) { in drmSLInsert()
203 level = ++list->level; in drmSLInsert()
204 update[level] = list->head; in drmSLInsert()
215 ++list->count; in drmSLInsert()
221 SkipListPtr list = (SkipListPtr)l; in drmSLDelete() local
226 if (list->magic != SL_LIST_MAGIC) return -1; /* Bad magic */ in drmSLDelete()
228 entry = SLLocate(list, key, update); in drmSLDelete()
233 for (i = 0; i <= list->level; i++) { in drmSLDelete()
241 while (list->level && !list->head->forward[list->level]) --list->level; in drmSLDelete()
242 --list->count; in drmSLDelete()
248 SkipListPtr list = (SkipListPtr)l; in drmSLLookup() local
252 entry = SLLocate(list, key, update); in drmSLLookup()
266 SkipListPtr list = (SkipListPtr)l; in drmSLLookupNeighbors() local
288 SkipListPtr list = (SkipListPtr)l; in drmSLNext() local
291 if (list->magic != SL_LIST_MAGIC) return -1; /* Bad magic */ in drmSLNext()
293 entry = list->p0; in drmSLNext()
296 list->p0 = entry->forward[0]; in drmSLNext()
301 list->p0 = NULL; in drmSLNext()
307 SkipListPtr list = (SkipListPtr)l; in drmSLFirst() local
309 if (list->magic != SL_LIST_MAGIC) return -1; /* Bad magic */ in drmSLFirst()
311 list->p0 = list->head->forward[0]; in drmSLFirst()
312 return drmSLNext(list, key, value); in drmSLFirst()
318 SkipListPtr list = (SkipListPtr)l; in drmSLDump() local
322 if (list->magic != SL_LIST_MAGIC) { in drmSLDump()
324 list->magic, SL_LIST_MAGIC); in drmSLDump()
328 printf("Level = %d, count = %d\n", list->level, list->count); in drmSLDump()
329 for (entry = list->head; entry; entry = entry->forward[0]) { in drmSLDump()
332 list->magic, SL_ENTRY_MAGIC); in drmSLDump()
351 static void print(SkipListPtr list) in print() argument
356 if (drmSLFirst(list, &key, &value)) { in print()
359 } while (drmSLNext(list, &key, &value)); in print()
365 SkipListPtr list; in do_time() local
377 list = drmSLCreate(); in do_time()
381 drmSLInsert(list, keys[i], NULL); in do_time()
385 if (drmSLFirst(list, &key, &value)) { in do_time()
391 } while (drmSLNext(list, &key, &value)); in do_time()
397 if (drmSLLookup(list, keys[i], &value)) in do_time()
408 drmSLDestroy(list); in do_time()
413 static void print_neighbors(void *list, unsigned long key) in print_neighbors() argument
421 retval = drmSLLookupNeighbors(list, key, in print_neighbors()
430 SkipListPtr list; in main() local
433 list = drmSLCreate(); in main()
434 printf( "list at %p\n", list); in main()
436 print(list); in main()
439 drmSLInsert(list, 123, NULL); in main()
440 drmSLInsert(list, 213, NULL); in main()
441 drmSLInsert(list, 50, NULL); in main()
442 print(list); in main()
445 print_neighbors(list, 0); in main()
446 print_neighbors(list, 50); in main()
447 print_neighbors(list, 51); in main()
448 print_neighbors(list, 123); in main()
449 print_neighbors(list, 200); in main()
450 print_neighbors(list, 213); in main()
451 print_neighbors(list, 256); in main()
454 drmSLDelete(list, 50); in main()
455 print(list); in main()
458 drmSLDump(list); in main()
459 drmSLDestroy(list); in main()