mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
cleanup: Don't use memcpy where assignment can be used.
See https://github.com/TokTok/hs-tokstyle/pull/104.
This commit is contained in:
parent
7411f70109
commit
f46f51e554
|
@ -1 +1 @@
|
|||
973f8254b9f8c50cbf0df93fb609d83bfeaeffdcbe7b836d6e0f701bdabf493f /usr/local/bin/tox-bootstrapd
|
||||
c2d45e89278e21f452cce2589299648bb94c38d75b0e974fb4f1c012182543af /usr/local/bin/tox-bootstrapd
|
||||
|
|
|
@ -1580,9 +1580,7 @@ int dht_delfriend(DHT *dht, const uint8_t *public_key, uint16_t lock_count)
|
|||
--dht->num_friends;
|
||||
|
||||
if (dht->num_friends != friend_num) {
|
||||
memcpy(&dht->friends_list[friend_num],
|
||||
&dht->friends_list[dht->num_friends],
|
||||
sizeof(DHT_Friend));
|
||||
dht->friends_list[friend_num] = dht->friends_list[dht->num_friends];
|
||||
}
|
||||
|
||||
if (dht->num_friends == 0) {
|
||||
|
|
|
@ -154,7 +154,7 @@ static void wipe_secure_connection(TCP_Secure_Connection *con)
|
|||
|
||||
static void move_secure_connection(TCP_Secure_Connection *con_new, TCP_Secure_Connection *con_old)
|
||||
{
|
||||
memcpy(con_new, con_old, sizeof(TCP_Secure_Connection));
|
||||
*con_new = *con_old;
|
||||
crypto_memzero(con_old, sizeof(TCP_Secure_Connection));
|
||||
}
|
||||
|
||||
|
|
|
@ -755,7 +755,7 @@ static int add_data_to_buffer(const Logger *log, Packets_Array *array, uint32_t
|
|||
return -1;
|
||||
}
|
||||
|
||||
memcpy(new_d, data, sizeof(Packet_Data));
|
||||
*new_d = *data;
|
||||
array->buffer[num] = new_d;
|
||||
|
||||
if (number - array->buffer_start >= num_packets_array(array)) {
|
||||
|
@ -808,7 +808,7 @@ static int64_t add_data_end_of_buffer(const Logger *log, Packets_Array *array, c
|
|||
return -1;
|
||||
}
|
||||
|
||||
memcpy(new_d, data, sizeof(Packet_Data));
|
||||
*new_d = *data;
|
||||
uint32_t id = array->buffer_end;
|
||||
array->buffer[id % CRYPTO_PACKET_BUFFER_SIZE] = new_d;
|
||||
++array->buffer_end;
|
||||
|
@ -832,7 +832,7 @@ static int64_t read_data_beg_buffer(const Logger *log, Packets_Array *array, Pac
|
|||
return -1;
|
||||
}
|
||||
|
||||
memcpy(data, array->buffer[num], sizeof(Packet_Data));
|
||||
*data = *array->buffer[num];
|
||||
uint32_t id = array->buffer_start;
|
||||
++array->buffer_start;
|
||||
free(array->buffer[num]);
|
||||
|
|
|
@ -391,7 +391,7 @@ static int random_path(const Onion_Client *onion_c, Onion_Client_Paths *onion_pa
|
|||
}
|
||||
|
||||
++onion_paths->last_path_used_times[pathnum];
|
||||
memcpy(path, &onion_paths->paths[pathnum], sizeof(Onion_Path));
|
||||
*path = onion_paths->paths[pathnum];
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user