mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2025-04-21 12:27:27 +03:00
eeshow/misc/util.h (realloc_size, realloc_type_n): get rid of bare "realloc"
Finally ! Shoulds have done this a long time ago.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user