summaryrefslogtreecommitdiff
path: root/gfx
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-22 21:00:10 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-22 21:00:40 -0300
commitce690a463d1905b2aba8a04c29a248af66153681 (patch)
tree96072589d04ca8b1c536c6a0b5c8f58c7c2a21b1 /gfx
parent8dfb6b2c9f722d70b30e5794fe20ce9450dd05d4 (diff)
downloadeeshow-ce690a463d1905b2aba8a04c29a248af66153681.tar.gz
eeshow-ce690a463d1905b2aba8a04c29a248af66153681.tar.bz2
eeshow-ce690a463d1905b2aba8a04c29a248af66153681.zip
eeshow/misc/util.h (realloc_size, realloc_type_n): get rid of bare "realloc"
Finally ! Shoulds have done this a long time ago.
Diffstat (limited to 'gfx')
-rw-r--r--gfx/cro.c4
-rw-r--r--gfx/fig.c2
-rw-r--r--gfx/pdftoc.c3
3 files changed, 3 insertions, 6 deletions
diff --git a/gfx/cro.c b/gfx/cro.c
index 21cbda3..91e0ed4 100644
--- a/gfx/cro.c
+++ b/gfx/cro.c
@@ -404,9 +404,7 @@ static void cr_pdf_new_sheet(void *ctx)
struct cro_ctx *cc = ctx;
cc->n_sheets++;
- cc->sheets = realloc(cc->sheets, sizeof(struct record) * cc->n_sheets);
- if (!cc->sheets)
- diag_pfatal("realloc");
+ cc->sheets = realloc_type_n(cc->sheets, struct record, cc->n_sheets);
cc->sheets[cc->n_sheets - 1] = cc->record;
record_wipe(&cc->record);
}
diff --git a/gfx/fig.c b/gfx/fig.c
index fa1365c..41d4933 100644
--- a/gfx/fig.c
+++ b/gfx/fig.c
@@ -262,7 +262,7 @@ static void *fig_init(int argc, char *const *argv)
if (!strchr(argv[arg], '='))
usage(*argv);
n_vars++;
- vars = realloc(vars, sizeof(const char *) * n_vars);
+ vars = realloc_type_n(vars, const char *, n_vars);
vars[n_vars - 1] = argv[arg];
}
diff --git a/gfx/pdftoc.c b/gfx/pdftoc.c
index 5324823..cf45859 100644
--- a/gfx/pdftoc.c
+++ b/gfx/pdftoc.c
@@ -114,8 +114,7 @@ static void add_object(struct pdftoc *ctx, int id, int gen, unsigned pos)
struct object *obj;
if (id > ctx->top) {
- ctx->objs = realloc(ctx->objs,
- (id + 1) * sizeof(struct object));
+ ctx->objs = realloc_type_n(ctx->objs, struct object, id + 1);
memset(ctx->objs + ctx->top + 1 , 0,
(id - ctx->top) * sizeof(struct object));
ctx->top = id;