refactor: cleanup PacketResponseNG init
This commit is contained in:
1 parent
9129cd6442
commit
ef0bae7bc6
4 files changed
+11
-57
No files matched your search
+5
-23
@@ -1030,18 +1030,9 @@ size_t WaitForRawDataTimeout(uint8_t *buffer, size_t len, size_t ms_timeout, boo
|
||||
*/
|
||||
bool WaitForResponseTimeoutW(uint32_t cmd, PacketResponseNG *response, size_t ms_timeout, bool show_warning) {
|
||||
|
||||
PacketResponseNG resp;
|
||||
// init to ZERO
|
||||
resp.cmd = 0,
|
||||
resp.length = 0,
|
||||
resp.magic = 0,
|
||||
resp.status = 0,
|
||||
resp.crc = 0,
|
||||
resp.ng = false,
|
||||
resp.oldarg[0] = 0;
|
||||
resp.oldarg[1] = 0;
|
||||
resp.oldarg[2] = 0;
|
||||
memset(resp.data.asBytes, 0, PM3_CMD_DATA_SIZE);
|
||||
PacketResponseNG resp;
|
||||
memset(&resp, 0, sizeof(resp));
|
||||
|
||||
if (response == NULL) {
|
||||
response = &resp;
|
||||
@@ -1118,23 +1109,14 @@ bool GetFromDevice(DeviceMemType_t memtype, uint8_t *dest, uint32_t bytes, uint3
|
||||
|
||||
if (dest == NULL) return false;
|
||||
|
||||
// init to ZERO
|
||||
PacketResponseNG resp;
|
||||
memset(&resp, 0, sizeof(resp));
|
||||
|
||||
if (response == NULL) {
|
||||
response = &resp;
|
||||
}
|
||||
|
||||
// init to ZERO
|
||||
resp.cmd = 0,
|
||||
resp.length = 0,
|
||||
resp.magic = 0,
|
||||
resp.status = 0,
|
||||
resp.crc = 0,
|
||||
resp.ng = false,
|
||||
resp.oldarg[0] = 0;
|
||||
resp.oldarg[1] = 0;
|
||||
resp.oldarg[2] = 0;
|
||||
memset(resp.data.asBytes, 0, PM3_CMD_DATA_SIZE);
|
||||
|
||||
if (bytes == 0) return true;
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user