소스 검색

mmu: Use strncpy when possible

Since tmp is always null-terminated we can save some time compared to a
memcpy call.
Yuri D'Elia 2 년 전
부모
커밋
9f3f0baa47
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      Firmware/mmu2_protocol_logic.cpp

+ 1 - 1
Firmware/mmu2_protocol_logic.cpp

@@ -715,7 +715,7 @@ void ProtocolLogic::LogRequestMsg(const uint8_t *txbuff, uint8_t size) {
     } else {
         MMU2_ECHO_MSGLN(tmp);
     }
-    memcpy(lastMsg, tmp, rqs);
+    strncpy(lastMsg, tmp, rqs);
 }
 
 void ProtocolLogic::LogError(const char *reason_P) {