Exemple #1
0
/* Free resources */
void cfwDictFree(cfwCtx g) {
	dictCtx h = g->ctx.dict;

	if (h == NULL) {
		return;
	}

	dnaFREE(h->tmp);

	cfwMemFree(g, h);
	g->ctx.dict = NULL;
}
/* Free resources */
void cfwEncodingFree(cfwCtx g) {
    encodingCtx h = g->ctx.encoding;
    int i;

    if (h == NULL) {
        return;
    }

    for (i = 0; i < h->encodings.size; i++) {
        Encoding *encoding = &h->encodings.array[i];
        dnaFREE(encoding->codes);
        dnaFREE(encoding->supcodes);
    }
    dnaFREE(h->encodings);

    cfwMemFree(g, h);
    g->ctx.encoding = NULL;
}
Exemple #3
0
/* Free resources. */
void cfwCstrFree(cfwCtx g) {
	cstrCtx h = g->ctx.cstr;

	if (h == NULL) {
		return;
	}

	dnaFREE(h->cstr);
	dnaFREE(h->masks);
	dnaFREE(h->hints);
	dnaFREE(h->cntrs);

	/* Close tmp stream */
	if (g->cb.stm.close(&g->cb.stm, g->stm.tmp)) {
		cfwFatal(g, cfwErrTmpStream, NULL);
	}

	cfwMemFree(g, g->ctx.cstr);
	g->ctx.cstr = NULL;
}