summaryrefslogtreecommitdiff
path: root/fitz/stm_buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'fitz/stm_buffer.c')
-rw-r--r--fitz/stm_buffer.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/fitz/stm_buffer.c b/fitz/stm_buffer.c
index 4c7410c3..eb96cd2f 100644
--- a/fitz/stm_buffer.c
+++ b/fitz/stm_buffer.c
@@ -1,15 +1,15 @@
#include "fitz.h"
fz_buffer *
-fz_new_buffer(int size)
+fz_new_buffer(fz_context *ctx, int size)
{
fz_buffer *b;
size = size > 1 ? size : 16;
- b = fz_malloc(sizeof(fz_buffer));
+ b = fz_malloc(ctx, sizeof(fz_buffer));
b->refs = 1;
- b->data = fz_malloc(size);
+ b->data = fz_malloc(ctx, size);
b->cap = size;
b->len = 0;
@@ -24,26 +24,26 @@ fz_keep_buffer(fz_buffer *buf)
}
void
-fz_drop_buffer(fz_buffer *buf)
+fz_drop_buffer(fz_context *ctx, fz_buffer *buf)
{
if (--buf->refs == 0)
{
- fz_free(buf->data);
- fz_free(buf);
+ fz_free(ctx, buf->data);
+ fz_free(ctx, buf);
}
}
void
-fz_resize_buffer(fz_buffer *buf, int size)
+fz_resize_buffer(fz_context *ctx, fz_buffer *buf, int size)
{
- buf->data = fz_realloc(buf->data, size, 1);
+ buf->data = fz_resize_array(ctx, buf->data, size, 1);
buf->cap = size;
if (buf->len > buf->cap)
buf->len = buf->cap;
}
void
-fz_grow_buffer(fz_buffer *buf)
+fz_grow_buffer(fz_context *ctx, fz_buffer *buf)
{
- fz_resize_buffer(buf, (buf->cap * 3) / 2);
+ fz_resize_buffer(ctx, buf, (buf->cap * 3) / 2);
}