/* ** (c) COPYRIGHT CERN 1994. ** Please first read the full copyright statement in the file COPYRIGH. */This module implements a flexible array. It is a general utility module. A chunk is a structure which may be extended. These routines create and append data to chunks, automatically reallocating them as necessary. It is garanteed that the array is '\0' terminated at all times, so the terminating function, HTChunkTerminate is only necessary to get the right size in the chunk structure.
This module is implemented by HTChunk.c, and it is a part of the Library of Common Code.
#ifndef HTCHUNK_H #define HTCHUNK_H
typedef struct { int size; /* In bytes */ int growby; /* Allocation unit in bytes */ int allocated; /* Current size of *data */ char * data; /* Pointer to malloced area or 0 */ } HTChunk; #ifdef SHORT_NAMES #define HTChunkClear HTChClea #define HTChunkPutc HTChPutc #define HTChunkPuts HTChPuts #define HTChunkCreate HTChCrea #define HTChunkTerminate HTChTerm #define HTChunkEnsure HtChEnsu #endif
extern HTChunk * HTChunkCreate PARAMS((int growby));
extern void HTChunkFree PARAMS((HTChunk * ch));
extern void HTChunkClear PARAMS((HTChunk * ch));
extern void HTChunkEnsure PARAMS((HTChunk * ch, int s));
extern void HTChunkPutc PARAMS((HTChunk * ch, char c));
extern void HTChunkPuts PARAMS((HTChunk * ch, const char *str));
extern void HTChunkTerminate PARAMS((HTChunk * ch)); #endifend