Bug 1943761 - Add class alignment to the mozsearch analysis file. r=asuth
[gecko.git] / other-licenses / 7zstub / src / C / 7zBuf.c
blob438bba68bdfd2553f2de7d2d304a20711434546c
1 /* 7zBuf.c -- Byte Buffer
2 2017-04-03 : Igor Pavlov : Public domain */
4 #include "Precomp.h"
6 #include "7zBuf.h"
8 void Buf_Init(CBuf *p)
10 p->data = 0;
11 p->size = 0;
14 int Buf_Create(CBuf *p, size_t size, ISzAllocPtr alloc)
16 p->size = 0;
17 if (size == 0)
19 p->data = 0;
20 return 1;
22 p->data = (Byte *)ISzAlloc_Alloc(alloc, size);
23 if (p->data)
25 p->size = size;
26 return 1;
28 return 0;
31 void Buf_Free(CBuf *p, ISzAllocPtr alloc)
33 ISzAlloc_Free(alloc, p->data);
34 p->data = 0;
35 p->size = 0;