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.
smime.p7s
Description: S/MIME cryptographic signature
