예제 #1
0
파일: skiplist.c 프로젝트: thefunk/skiplist
void SkipListDestroy(SkipList *list) {
    if (!list) return;
    
    SkipListResetBookmark(list);
    SkipListNode *node = SkipListGetNext(list);
    while (node) {
        SkipListNode *nextNode = SkipListGetNext(list);
        SkipListNodeDestroy(list, node);
        node = nextNode;
    }
    free(list);
}
예제 #2
0
파일: skiplist.c 프로젝트: samuelmay/mchat
static void getNextValue( SkipList_t *list )
{
    char buf[256];
    int  key = 0;
    SkipListNode_t *node;
    
    printf( "\n\nEnter the NEXT value to be found : " );
    gets( buf );
    key = atoi(buf);
    printf( "Getting the next element for the key %d ...\n", key );
    node = SkipListGetNext( list, (void *)key );
    if ( node == NULL ) {
        printf( "There is no next element\n" );
    }
    else {
        printf( "Search is successful\n" );
        printf( "Next element is %d\n", (int)node->value );
    }    
}
예제 #3
0
파일: skiplist.c 프로젝트: thefunk/skiplist
void SkipListGetNextKeyValue(SkipListRef list, void **key, void **value) {
    assert(list && key && value);
    SkipListNode *node = SkipListGetNext(list);
    *key = node ? node->key : NULL;
    *value = node ? node->value : NULL;
}