On Fri, Jan 09, 2015 at 15:45, Brent Cook wrote:
> From: Brent Cook <bust...@gmail.com>
> 
> Yeah yeah, a pointer is a pointer (except when it isn't :). I think this
> looks nicer, since idx2peer is really the thing we're allocating to.

what about the bzero ten lines later?

I think the sizeof(*idx2peer) idiom is also a little nicer. and you
can change the other reallocarray too.

> 
> ok?
> ---
> src/usr.sbin/ntpd/ntp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/usr.sbin/ntpd/ntp.c b/src/usr.sbin/ntpd/ntp.c
> index 8c46bfc..41162bb 100644
> --- a/src/usr.sbin/ntpd/ntp.c
> +++ b/src/usr.sbin/ntpd/ntp.c
> @@ -200,7 +200,7 @@ ntp_main(int pipe_prnt[2], int fd_ctl, struct
> ntpd_conf *nconf,
> while (ntp_quit == 0) {
> if (peer_cnt > idx2peer_elms) {
> if ((newp = reallocarray(idx2peer, peer_cnt,
> -                         sizeof(void *))) == NULL) {
> +                         sizeof(struct ntp_peer *))) == NULL) {
> /* panic for now */
> log_warn("could not resize idx2peer from %u -> "
> "%u entries", idx2peer_elms, peer_cnt);

Reply via email to