qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v10 32/59] hw/xen: Implement EVTCHNOP_bind_virq


From: David Woodhouse
Subject: Re: [PATCH v10 32/59] hw/xen: Implement EVTCHNOP_bind_virq
Date: Wed, 15 Feb 2023 13:08:54 +0000
User-agent: Evolution 3.44.4-0ubuntu1

On Fri, 2023-02-10 at 13:48 +0000, Paul Durrant wrote:
> 
> > +static int allocate_port(XenEvtchnState *s, uint32_t vcpu,
> > uint16_t type,
> > +                         uint16_t val, evtchn_port_t *port)
> > +{
> > +    evtchn_port_t p = 1;
> > +
> > +    for (p = 1; valid_port(p); p++) {
> > +        if (s->port_table[p].type == EVTCHNSTAT_closed) {
> > +            s->port_table[p].vcpu = vcpu;
> > +            s->port_table[p].type = type;
> > +            s->port_table[p].type_val = val;
> 
> It'd be neater to use a structured initializer to create a port_table
> entry on stack and then do a single assignment.

I dunno, I've always hated this part of C. If I could just make it
s->port_table[p] = { vcpu, type, val }; that'd be fine, but setting up
a local variable just for the assignment is a bit clunky too.

Attachment: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]