[systemd-devel] [systemd-commits] src/libsystemd-network src/systemd
Lennart Poettering
lennart at poettering.net
Tue Apr 29 03:37:35 PDT 2014
On Tue, 29.04.14 03:27, Tom Gundersen (tomegun at kemper.freedesktop.org) wrote:
> + case DHCP_OPTION_NTP_SERVER:
> + if (len && !(len % 4)) {
> + unsigned i;
> +
> + lease->ntp_size = len / 4;
> +
> + free(lease->ntp);
> + lease->ntp = new0(struct in_addr, lease->ntp_size);
> + if (!lease->ntp)
> + return -ENOMEM;
> +
> + for (i = 0; i < lease->ntp_size; i++) {
> + memcpy(&lease->ntp[i].s_addr, option + 4 * i, 4);
> + }
This should be shorter, no?
lease->ntp = newdup(struct in_addr, option, lease->ntp_size);
if (!lease->ntp) ...
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list