Roll src/third_party/skia c6f3e2c:efb7e42
[chromium-blink-merge.git] / third_party / lzma_sdk / 7zBuf.c
blob14e7f4e2b92215c6a6ba4186917b4602d620fe9a
1 /* 7zBuf.c -- Byte Buffer
2 2008-03-28
3 Igor Pavlov
4 Public domain */
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, ISzAlloc *alloc)
16 p->size = 0;
17 if (size == 0)
19 p->data = 0;
20 return 1;
22 p->data = (Byte *)alloc->Alloc(alloc, size);
23 if (p->data != 0)
25 p->size = size;
26 return 1;
28 return 0;
31 void Buf_Free(CBuf *p, ISzAlloc *alloc)
33 alloc->Free(alloc, p->data);
34 p->data = 0;
35 p->size = 0;