refactor builder struct

This commit is contained in:
yihaoDeng 2021-12-01 08:46:22 +08:00
parent d46ca756bf
commit f6908c8d14
1 changed files with 3 additions and 1 deletions

View File

@ -1315,7 +1315,7 @@ StreamWithStateResult *swsResultCreate(FstSlice *data, FstOutput fOut, void *sta
StreamWithStateResult *result = calloc(1, sizeof(StreamWithStateResult)); StreamWithStateResult *result = calloc(1, sizeof(StreamWithStateResult));
if (result == NULL) { return NULL; } if (result == NULL) { return NULL; }
FstSlice s = fstSliceCopy(data, 0, FST_SLICE_LEN(data) - 1); result->data = fstSliceCopy(data, 0, FST_SLICE_LEN(data) - 1);
result->data = s; result->data = s;
result->out = fOut; result->out = fOut;
result->state = state; result->state = state;
@ -1342,6 +1342,8 @@ FstStreamBuilder *fstStreamBuilderCreate(Fst *fst, Automation *aut) {
return b; return b;
} }
void fstStreamBuilderDestroy(FstStreamBuilder *b) { void fstStreamBuilderDestroy(FstStreamBuilder *b) {
fstSliceDestroy(&b->min);
fstSliceDestroy(&b->max);
free(b); free(b);
} }
FstStreamBuilder *fstStreamBuilderRange(FstStreamBuilder *b, FstSlice *val, RangeType type) { FstStreamBuilder *fstStreamBuilderRange(FstStreamBuilder *b, FstSlice *val, RangeType type) {