tidy memset

This commit is contained in:
Jethro Grassie 2019-12-22 15:27:33 -05:00
parent 0ae2946486
commit c9346f4a3d
No known key found for this signature in database
GPG key ID: DE8ED755616565BB

View file

@ -1865,7 +1865,6 @@ send_payments(void)
size_t payments_max_count = 25; size_t payments_max_count = 25;
size_t payments_size = payments_max_count * sizeof(payment_t); size_t payments_size = payments_max_count * sizeof(payment_t);
payment_t *payments = (payment_t*) calloc(1, payments_size); payment_t *payments = (payment_t*) calloc(1, payments_size);
memset(payments, 0, payments_size);
payment_t *payment = payments; payment_t *payment = payments;
payment_t *end_payment = payment + payments_max_count; payment_t *end_payment = payment + payments_max_count;
@ -1995,9 +1994,11 @@ client_add(int fd, struct bufferevent *bev)
pool_clients.count); pool_clients.count);
pool_clients.clients = c; pool_clients.clients = c;
c += pool_clients.count - POOL_CLIENTS_GROW; c += pool_clients.count - POOL_CLIENTS_GROW;
memset(c, 0, sizeof(client_t) * POOL_CLIENTS_GROW);
pthread_mutex_unlock(&mutex_clients); pthread_mutex_unlock(&mutex_clients);
log_debug("Client pool can now hold %zu clients", pool_clients.count); log_debug("Client pool can now hold %zu clients", pool_clients.count);
} }
else
memset(c, 0, sizeof(client_t)); memset(c, 0, sizeof(client_t));
c->fd = fd; c->fd = fd;
c->bev = bev; c->bev = bev;