Mercurial > hg > dmlib
comparison src/dmgrowbuf.h @ 1700:a2e65aa47554
Implement dmGrowBufConstCopy() and dmGrowBufCreateFrom(), and also
DMGrowBuf::is_const flag, that marks a buffer "unmodifiable", though
obviously that is not strictly enforced.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 05 Jun 2018 15:04:15 +0300 |
parents | f71cd6691e05 |
children | 7eb00206b36d |
comparison
equal
deleted
inserted
replaced
1699:f71cd6691e05 | 1700:a2e65aa47554 |
---|---|
28 mingrow; // Minimum amount of bytes the allocation size grows by | 28 mingrow; // Minimum amount of bytes the allocation size grows by |
29 | 29 |
30 BOOL | 30 BOOL |
31 allocated, // TRUE if this structure itself has been allocated and can be freed, FALSE if static | 31 allocated, // TRUE if this structure itself has been allocated and can be freed, FALSE if static |
32 backwards, // TRUE if the buffer grows backwards (e.g. "offs" moves backwards) | 32 backwards, // TRUE if the buffer grows backwards (e.g. "offs" moves backwards) |
33 literal; // TRUE if dmGrowBufPut*() functions stores data "literally" in backwards mode | 33 literal, // TRUE if dmGrowBufPut*() functions stores data "literally" in backwards mode |
34 is_const; // TRUE will cause any reallocs etc. modifications to fail | |
34 } DMGrowBuf; | 35 } DMGrowBuf; |
35 | 36 |
36 | 37 |
37 int dmGrowBufInit(DMGrowBuf *buf); | 38 int dmGrowBufInit(DMGrowBuf *buf); |
38 int dmGrowBufAlloc(DMGrowBuf *buf, const size_t initial, const size_t mingrow); | 39 int dmGrowBufAlloc(DMGrowBuf *buf, const size_t initial, const size_t mingrow); |
39 int dmGrowBufNew(DMGrowBuf **pbuf, const size_t initial, const size_t mingrow); | 40 int dmGrowBufNew(DMGrowBuf **pbuf, const size_t initial, const size_t mingrow); |
40 void dmGrowBufFree(DMGrowBuf *buf); | 41 void dmGrowBufFree(DMGrowBuf *buf); |
42 | |
43 DMGrowBuf * dmGrowBufConstCopy(DMGrowBuf *dst, const DMGrowBuf *src); | |
44 DMGrowBuf * dmGrowBufCreateFrom(DMGrowBuf *buf, Uint8 *data, size_t len); | |
41 | 45 |
42 BOOL dmGrowBufGrow(DMGrowBuf *buf, const size_t amount); | 46 BOOL dmGrowBufGrow(DMGrowBuf *buf, const size_t amount); |
43 BOOL dmGrowBufCheckGrow(DMGrowBuf *buf, const size_t nsize); | 47 BOOL dmGrowBufCheckGrow(DMGrowBuf *buf, const size_t nsize); |
44 | 48 |
45 BOOL dmGrowBufPut(DMGrowBuf *buf, const Uint8 *data, const size_t len); | 49 BOOL dmGrowBufPut(DMGrowBuf *buf, const Uint8 *data, const size_t len); |