1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-14 05:33:03 +01:00

Use compound literals to zero out structs instead of memset

This commit is contained in:
zugz (tox) 2020-11-14 00:00:00 +00:00
parent 4581dee4fc
commit ba5ded9bc2
No known key found for this signature in database
GPG Key ID: 6F2BDA289D04F249
2 changed files with 7 additions and 2 deletions

View File

@ -164,7 +164,9 @@ bool init_call(Call *call)
return false;
}
memset(call, 0, sizeof(Call));
*call = (struct Call) {
0
};
call->status = cs_Pending;

View File

@ -560,11 +560,14 @@ static void update_peer_list(Tox *m, uint32_t conferencenum, uint32_t num_peers,
}
realloc_peer_list(chat, num_peers);
memset(chat->peer_list, 0, num_peers * sizeof(ConferencePeer));
for (uint32_t i = 0; i < num_peers; ++i) {
ConferencePeer *peer = &chat->peer_list[i];
*peer = (struct ConferencePeer) {
0
};
Tox_Err_Conference_Peer_Query err;
tox_conference_peer_get_public_key(m, conferencenum, i, peer->pubkey, &err);