Refactor AVCLAN_parseframe call signature to avoid dynamic allocs

This commit is contained in:
Allen Hill
2026-05-05 20:35:05 -07:00
parent 9b2c71fa6e
commit c904bc2c89
3 changed files with 45 additions and 30 deletions
+9 -7
View File
@@ -178,13 +178,15 @@ int main() {
} // else (readSeq || readBinary); fall through to default
case '\n':
if (readSeq && readBinary && data_tmp[s_len] == 0x17) {
s_len--;
AVCLAN_frame_t *frame = AVCLAN_parseframe(data_tmp, s_len);
if (frame) {
AVCLAN_sendframe(frame);
free(frame);
readSeq = 0;
readBinary = 0;
{
uint8_t tmp[MAXMSGLEN];
AVCLAN_frame_t frame = {.data = tmp};
err = AVCLAN_parseframe(data_tmp, --s_len, &frame);
if (!err) {
AVCLAN_sendframe(frame);
readSeq = 0;
readBinary = 0;
}
}
break;
} // else (readSeq || readBinary || most recent char != 0x17);