Annotation of elwix/tools/oldlzma/SRC/7zip/Archive/7z_C/7zBuffer.c, revision 1.1
1.1 ! misho 1: /* 7zBuffer.c */
! 2:
! 3: #include "7zBuffer.h"
! 4: #include "7zAlloc.h"
! 5:
! 6: void SzByteBufferInit(CSzByteBuffer *buffer)
! 7: {
! 8: buffer->Capacity = 0;
! 9: buffer->Items = 0;
! 10: }
! 11:
! 12: int SzByteBufferCreate(CSzByteBuffer *buffer, size_t newCapacity, void * (*allocFunc)(size_t size))
! 13: {
! 14: buffer->Capacity = newCapacity;
! 15: buffer->Items = (Byte *)allocFunc(newCapacity);
! 16: return (buffer->Items != 0);
! 17: }
! 18:
! 19: void SzByteBufferFree(CSzByteBuffer *buffer, void (*freeFunc)(void *))
! 20: {
! 21: freeFunc(buffer->Items);
! 22: buffer->Items = 0;
! 23: buffer->Capacity = 0;
! 24: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>