/* $Cambridge: hermes/src/prayer/accountd/assoc.h,v 1.1.1.1 2003/04/15 13:00:03 dpc22 Exp $ */
/************************************************
* Prayer - a Webmail Interface *
************************************************/
/* Copyright (c) University of Cambridge 2000 - 2002 */
/* See the file NOTICE for conditions of use and distribution. */
/* Associative Arrays */
struct assoc_list { /* Single magazine for hash table */
struct assoc_list *next; /* Linked list */
char *key;
void *value;
};
struct assoc {
struct pool *pool; /* Allocate in this pool */
BOOL use_case; /* T => lookups are case dependant */
unsigned long size; /* Number of magazines for hash table */
unsigned long scanlist; /* For assoc scan stuff */
struct assoc_list *scan_elt;
struct assoc_list *list[1]; /* Placeholder for array */
};
struct assoc *assoc_create(struct pool *p, unsigned long size,
BOOL use_case);
void assoc_free(struct assoc *h);
void assoc_update(struct assoc *h, char *key, void *value, BOOL dup);
BOOL assoc_delete(struct assoc *h, char *key);
void *assoc_lookup(struct assoc *h, char *key);
void assoc_scan_reset(struct assoc *h);
BOOL assoc_scan_next(struct assoc *h, char **keyp, void **valuep);
syntax highlighted by Code2HTML, v. 0.9.1