Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

sorted_array.c File Reference


Detailed Description

Author:
Christian Biere
Date:
2007

#include "common.h"
#include "misc.h"
#include "walloc.h"
#include "override.h"

Data Structures

struct  sorted_array

Defines

#define GET_ITEM(i)   (sorted_array_item_intern(tab, (i)))
#define FOUND(i)

Functions

sorted_arraysorted_array_new (size_t item_size, int(*cmp_func)(const void *a, const void *b))
void sorted_array_free (struct sorted_array **tab_ptr)
void * sorted_array_item_intern (const struct sorted_array *tab, size_t i)
void * sorted_array_item (const struct sorted_array *tab, size_t i)
void * sorted_array_lookup (struct sorted_array *tab, const void *key)
void sorted_array_add (struct sorted_array *tab, const void *item)
void sorted_array_sync (struct sorted_array *tab, int(*collision_func)(const void *a, const void *b))
 This function must be called after sorted_array_add() to make the changes effective.
size_t sorted_array_size (const struct sorted_array *tab)


Define Documentation

#define FOUND  ) 
 

Value:

G_STMT_START { \
    return sorted_array_item_intern(tab, (i)); \
    /* NOTREACHED */ \
} G_STMT_END

#define GET_ITEM  )     (sorted_array_item_intern(tab, (i)))
 


Function Documentation

void sorted_array_add struct sorted_array tab,
const void *  item
 

void sorted_array_free struct sorted_array **  tab_ptr  ) 
 

void* sorted_array_item const struct sorted_array tab,
size_t  i
 

void* sorted_array_item_intern const struct sorted_array tab,
size_t  i
[static]
 

void* sorted_array_lookup struct sorted_array tab,
const void *  key
 

struct sorted_array* sorted_array_new size_t  item_size,
int(*)(const void *a, const void *b)  cmp_func
 

size_t sorted_array_size const struct sorted_array tab  ) 
 

void sorted_array_sync struct sorted_array tab,
int(*)(const void *a, const void *b)  collision_func
 

This function must be called after sorted_array_add() to make the changes effective.

As this function is costly, it should not be called each time but rather after the complete list of items has been added to the array

If collision_func is not NULL, it is used to decide which item will be removed if the array contains multiple equivalent items.


Generated on Sat Jun 30 17:53:31 2007 for gtk-gnutella by  doxygen 1.3.9.1