Mercurial > hg > dmlib
diff 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 |
line wrap: on
line diff
--- a/src/dmgrowbuf.h Tue Jun 05 15:02:56 2018 +0300 +++ b/src/dmgrowbuf.h Tue Jun 05 15:04:15 2018 +0300 @@ -30,7 +30,8 @@ BOOL allocated, // TRUE if this structure itself has been allocated and can be freed, FALSE if static backwards, // TRUE if the buffer grows backwards (e.g. "offs" moves backwards) - literal; // TRUE if dmGrowBufPut*() functions stores data "literally" in backwards mode + literal, // TRUE if dmGrowBufPut*() functions stores data "literally" in backwards mode + is_const; // TRUE will cause any reallocs etc. modifications to fail } DMGrowBuf; @@ -39,6 +40,9 @@ int dmGrowBufNew(DMGrowBuf **pbuf, const size_t initial, const size_t mingrow); void dmGrowBufFree(DMGrowBuf *buf); +DMGrowBuf * dmGrowBufConstCopy(DMGrowBuf *dst, const DMGrowBuf *src); +DMGrowBuf * dmGrowBufCreateFrom(DMGrowBuf *buf, Uint8 *data, size_t len); + BOOL dmGrowBufGrow(DMGrowBuf *buf, const size_t amount); BOOL dmGrowBufCheckGrow(DMGrowBuf *buf, const size_t nsize);