X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=include%2Fnmem.h;h=8713375101740839900268a0e9b77e1467848bde;hp=5e0a5210930f6e1b182436376f168311c82f205e;hb=6f4d57a5ce5f3f291ce118d8877c95d22ceb4e36;hpb=bf4149c63ad2e11429e302a89f472de52b4d7ce8 diff --git a/include/nmem.h b/include/nmem.h index 5e0a521..8713375 100644 --- a/include/nmem.h +++ b/include/nmem.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, Index Data. + * Copyright (c) 1995-1997, Index Data. * * Permission to use, copy, modify, distribute, and sell this software and * its documentation, in whole or in part, for any purpose, is hereby granted, @@ -28,19 +28,37 @@ #ifndef NMEM_H #define NMEM_H - +#include #ifdef __cplusplus extern "C" { #endif +typedef struct nmem_block +{ + char *buf; /* memory allocated in this block */ + int size; /* size of buf */ + int top; /* top of buffer */ + struct nmem_block *next; +} nmem_block; + +typedef struct nmem_control +{ + int total; + nmem_block *blocks; + struct nmem_control *next; +} nmem_control; + typedef struct nmem_control *NMEM; -void nmem_reset(NMEM n); -void *nmem_malloc(NMEM n, int size); -int nmem_total(NMEM n); -NMEM nmem_create(void); -void nmem_destroy(NMEM n); +YAZ_EXPORT void nmem_reset(NMEM n); +YAZ_EXPORT void *nmem_malloc(NMEM n, int size); +YAZ_EXPORT int nmem_total(NMEM n); +YAZ_EXPORT NMEM nmem_create(void); +YAZ_EXPORT void nmem_destroy(NMEM n); +YAZ_EXPORT char *nmem_strdup (NMEM mem, const char *src); +YAZ_EXPORT void nmem_init (void); +YAZ_EXPORT void nmem_exit (void); #ifdef __cplusplus } #endif