/* mmgr/ph_mmgr.h. Generated from mmgr.h.in by configure. */
/*
** Copyright 2000-2004 University of Illinois Board of Trustees
** Copyright 2000-2004 Mark D. Roth
** All rights reserved.
**
** ph_buffer.h - header file for buffer module
**
** Mark D. Roth <roth@uiuc.edu>
** Campus Information Technologies and Educational Services
** University of Illinois at Urbana-Champaign
*/
#ifndef ph_MMGR_H
#define ph_MMGR_H
#include <sys/types.h>
/* bits for mb_flags field */
#define ph_MMGR_ARRAY 256 /* array (elsize * nelem) */
typedef void (*ph_free_func_t)(void *);
struct ph_memblock
{
unsigned long mb_flags;
void *mb_ptr;
size_t mb_elsize;
size_t mb_nelem;
ph_free_func_t mb_freefunc;
};
typedef struct ph_memblock ph_memblock_t;
#define ph_mmgr_ptr(bp) ((bp)->mb_ptr)
#define ph_mmgr_size(bp) ((bp)->mb_nelem * (bp)->mb_elsize)
typedef struct ph_mmgr *ph_mmgr_t;
int ph_mmgr_init(ph_mmgr_t *);
void ph_mmgr_cleanup(ph_mmgr_t);
int ph_mmgr_malloc(ph_mmgr_t,
unsigned long,
size_t,
size_t,
ph_free_func_t,
ph_memblock_t **);
int ph_mmgr_register(ph_mmgr_t,
void *,
ph_free_func_t,
ph_memblock_t **);
int ph_mmgr_array_add(ph_memblock_t *,
size_t);
int ph_mmgr_realloc(ph_memblock_t *,
size_t);
int ph_mmgr_free(ph_memblock_t *,
int);
#endif /* ! ph_MMGR_H */
syntax highlighted by Code2HTML, v. 0.9.1