Skip to content

Commit

Permalink
[STAT] Implement STATReuse
Browse files Browse the repository at this point in the history
No idea what is the difference between Reuse and Free (presumably when
makeotf was used as a library to avoid re-allocating dynamic arrays?).
Implement it anyway for completeness sake, though it does not seem to
make any practical difference.
  • Loading branch information
khaledhosny committed Apr 30, 2020
1 parent f1eff6d commit ca4e3b9
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions c/makeotf/makeotf_lib/source/hotconv/STAT.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,22 +261,27 @@ void STATWrite(hotCtx g) {
}

void STATReuse(hotCtx g) {
}

void STATFree(hotCtx g) {
STATCtx h = g->ctx.STAT;
long i;

dnaFREE(h->designAxes);
dnaFREE(h->axisValues);

for (i = 0; i < h->axisValues.cnt; i++) {
AxisValueTable *av = &h->axisValues.array[i];
if (av->format == 4) {
MEM_FREE(g, av->format4.axisValues);
}
}

h->designAxes.cnt = 0;
h->axisValues.cnt = 0;
h->elidedFallbackNameID = 0;
}

void STATFree(hotCtx g) {
STATCtx h = g->ctx.STAT;

dnaFREE(h->designAxes);
dnaFREE(h->axisValues);

MEM_FREE(g, g->ctx.STAT);
}

Expand Down

0 comments on commit ca4e3b9

Please sign in to comment.