Lines Matching refs:list
102 SkipListPtr list; in drmSLCreate() local
105 list = drmMalloc(sizeof(*list)); in drmSLCreate()
106 if (!list) return NULL; in drmSLCreate()
107 list->magic = SL_LIST_MAGIC; in drmSLCreate()
108 list->level = 0; in drmSLCreate()
109 list->head = SLCreateEntry(SL_MAX_LEVEL, 0, NULL); in drmSLCreate()
110 list->count = 0; in drmSLCreate()
112 for (i = 0; i <= SL_MAX_LEVEL; i++) list->head->forward[i] = NULL; in drmSLCreate()
114 return list; in drmSLCreate()
119 SkipListPtr list = (SkipListPtr)l; in drmSLDestroy() local
123 if (list->magic != SL_LIST_MAGIC) return -1; /* Bad magic */ in drmSLDestroy()
125 for (entry = list->head; entry; entry = next) { in drmSLDestroy()
132 list->magic = SL_FREED_MAGIC; in drmSLDestroy()
133 drmFree(list); in drmSLDestroy()
139 SkipListPtr list = (SkipListPtr)l; in SLLocate() local
143 if (list->magic != SL_LIST_MAGIC) return NULL; in SLLocate()
145 for (i = list->level, entry = list->head; i >= 0; i--) { in SLLocate()
156 SkipListPtr list = (SkipListPtr)l; in drmSLInsert() local
162 if (list->magic != SL_LIST_MAGIC) return -1; /* Bad magic */ in drmSLInsert()
164 entry = SLLocate(list, key, update); in drmSLInsert()
170 if (level > list->level) { in drmSLInsert()
171 level = ++list->level; in drmSLInsert()
172 update[level] = list->head; in drmSLInsert()
183 ++list->count; in drmSLInsert()
189 SkipListPtr list = (SkipListPtr)l; in drmSLDelete() local
194 if (list->magic != SL_LIST_MAGIC) return -1; /* Bad magic */ in drmSLDelete()
196 entry = SLLocate(list, key, update); in drmSLDelete()
201 for (i = 0; i <= list->level; i++) { in drmSLDelete()
209 while (list->level && !list->head->forward[list->level]) --list->level; in drmSLDelete()
210 --list->count; in drmSLDelete()
216 SkipListPtr list = (SkipListPtr)l; in drmSLLookup() local
220 entry = SLLocate(list, key, update); in drmSLLookup()
234 SkipListPtr list = (SkipListPtr)l; in drmSLLookupNeighbors() local
238 SLLocate(list, key, update); in drmSLLookupNeighbors()
258 SkipListPtr list = (SkipListPtr)l; in drmSLNext() local
261 if (list->magic != SL_LIST_MAGIC) return -1; /* Bad magic */ in drmSLNext()
263 entry = list->p0; in drmSLNext()
266 list->p0 = entry->forward[0]; in drmSLNext()
271 list->p0 = NULL; in drmSLNext()
277 SkipListPtr list = (SkipListPtr)l; in drmSLFirst() local
279 if (list->magic != SL_LIST_MAGIC) return -1; /* Bad magic */ in drmSLFirst()
281 list->p0 = list->head->forward[0]; in drmSLFirst()
282 return drmSLNext(list, key, value); in drmSLFirst()
288 SkipListPtr list = (SkipListPtr)l; in drmSLDump() local
292 if (list->magic != SL_LIST_MAGIC) { in drmSLDump()
294 list->magic, SL_LIST_MAGIC); in drmSLDump()
298 printf("Level = %d, count = %d\n", list->level, list->count); in drmSLDump()
299 for (entry = list->head; entry; entry = entry->forward[0]) { in drmSLDump()
302 list->magic, SL_ENTRY_MAGIC); in drmSLDump()