mirror of
https://github.com/halleysfifthinc/AVCLAN-Mockingboard.git
synced 2026-08-07 01:13:18 +00:00
Refactor AVCLAN_parseframe call signature to avoid dynamic allocs
This commit is contained in:
+9
-7
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user