From: Yu Watanabe Date: Sun, 2 Oct 2022 13:51:31 +0000 (+0900) Subject: sd-dhcp6-client: rename buf -> p X-Git-Tag: v252-rc2~68^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=045422384093b97d21ae6296bd651555d9eeebea;p=thirdparty%2Fsystemd.git sd-dhcp6-client: rename buf -> p No functional changes, just preparation for the next commit. --- diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c index 2704e1ca5a9..e27a5c4fe13 100644 --- a/src/libsystemd-network/sd-dhcp6-client.c +++ b/src/libsystemd-network/sd-dhcp6-client.c @@ -641,7 +641,7 @@ static DHCP6MessageType client_message_type_from_state(sd_dhcp6_client *client) } static int client_append_oro(sd_dhcp6_client *client, uint8_t **opt, size_t *optlen) { - _cleanup_free_ be16_t *buf = NULL; + _cleanup_free_ be16_t *p = NULL; be16_t *req_opts; size_t n; @@ -652,29 +652,29 @@ static int client_append_oro(sd_dhcp6_client *client, uint8_t **opt, size_t *opt switch (client->state) { case DHCP6_STATE_INFORMATION_REQUEST: n = client->n_req_opts; - buf = new(be16_t, n + 2); - if (!buf) + p = new(be16_t, n + 2); + if (!p) return -ENOMEM; - memcpy_safe(buf, client->req_opts, n * sizeof(be16_t)); - buf[n++] = htobe16(SD_DHCP6_OPTION_INFORMATION_REFRESH_TIME); /* RFC 8415 section 21.23 */ - buf[n++] = htobe16(SD_DHCP6_OPTION_INF_MAX_RT); /* RFC 8415 section 21.25 */ + memcpy_safe(p, client->req_opts, n * sizeof(be16_t)); + p[n++] = htobe16(SD_DHCP6_OPTION_INFORMATION_REFRESH_TIME); /* RFC 8415 section 21.23 */ + p[n++] = htobe16(SD_DHCP6_OPTION_INF_MAX_RT); /* RFC 8415 section 21.25 */ - typesafe_qsort(buf, n, be16_compare_func); - req_opts = buf; + typesafe_qsort(p, n, be16_compare_func); + req_opts = p; break; case DHCP6_STATE_SOLICITATION: n = client->n_req_opts; - buf = new(be16_t, n + 1); - if (!buf) + p = new(be16_t, n + 1); + if (!p) return -ENOMEM; - memcpy_safe(buf, client->req_opts, n * sizeof(be16_t)); - buf[n++] = htobe16(SD_DHCP6_OPTION_SOL_MAX_RT); /* RFC 8415 section 21.24 */ + memcpy_safe(p, client->req_opts, n * sizeof(be16_t)); + p[n++] = htobe16(SD_DHCP6_OPTION_SOL_MAX_RT); /* RFC 8415 section 21.24 */ - typesafe_qsort(buf, n, be16_compare_func); - req_opts = buf; + typesafe_qsort(p, n, be16_compare_func); + req_opts = p; break; default: