add pbuf_copy_partial moc so I don't need if TESTING preprocessor directive
This commit is contained in:
2023-11-30 10:17:57 +01:00
parent f16e92b7d8
commit d7ff0010bd
3 changed files with 10 additions and 6 deletions

View File

@@ -209,11 +209,8 @@ static err_t tcp_cmd_recv_new(void* arg, struct tcp_pcb* pcb, struct pbuf* p, er
LOG_WARN(TAG, "Command too long");
}
size_t len = p->tot_len >= MAX_CMD_LEN ? MAX_CMD_LEN : p->tot_len;
#if TESTING
memcpy(cmd, p->payload, len);
#else
pbuf_copy_partial(p, cmd, len, 0);
#endif
cmd[len] = '\0';
remove_newline(cmd);