slirp: replace ARRAY_SIZE with G_N_ELEMENTS
Do not require QEMU macro. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
This commit is contained in:
parent
3a78c2f468
commit
37b9117faa
|
@ -128,7 +128,7 @@ void ncsi_input(Slirp *slirp, const uint8_t *pkt, int pkt_len)
|
||||||
memset(reh->h_source, 0xff, ETH_ALEN);
|
memset(reh->h_source, 0xff, ETH_ALEN);
|
||||||
reh->h_proto = htons(ETH_P_NCSI);
|
reh->h_proto = htons(ETH_P_NCSI);
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(ncsi_rsp_handlers); i++) {
|
for (i = 0; i < G_N_ELEMENTS(ncsi_rsp_handlers); i++) {
|
||||||
if (ncsi_rsp_handlers[i].type == nh->type + 0x80) {
|
if (ncsi_rsp_handlers[i].type == nh->type + 0x80) {
|
||||||
handler = &ncsi_rsp_handlers[i];
|
handler = &ncsi_rsp_handlers[i];
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -359,7 +359,7 @@ static void tftp_handle_rrq(Slirp *slirp, struct sockaddr_storage *srcsas,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (k < pktlen && nb_options < ARRAY_SIZE(option_name)) {
|
while (k < pktlen && nb_options < G_N_ELEMENTS(option_name)) {
|
||||||
const char *key, *value;
|
const char *key, *value;
|
||||||
|
|
||||||
key = &tp->x.tp_buf[k];
|
key = &tp->x.tp_buf[k];
|
||||||
|
@ -403,7 +403,7 @@ static void tftp_handle_rrq(Slirp *slirp, struct sockaddr_storage *srcsas,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nb_options > 0) {
|
if (nb_options > 0) {
|
||||||
assert(nb_options <= ARRAY_SIZE(option_name));
|
assert(nb_options <= G_N_ELEMENTS(option_name));
|
||||||
tftp_send_oack(spt, option_name, option_value, nb_options, tp);
|
tftp_send_oack(spt, option_name, option_value, nb_options, tp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue