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

Re: [Xen-devel] [PATCH 01/12] libxc/save: Shrink code volume where possible


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • From: Ian Jackson <ian.jackson@xxxxxxxxxx>
  • Date: Tue, 14 Jan 2020 16:55:54 +0000
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=ian.jackson@xxxxxxxxxx; spf=Pass smtp.mailfrom=Ian.Jackson@xxxxxxxxxx; spf=None smtp.helo=postmaster@xxxxxxxxxxxxxxx
  • Delivery-date: Tue, 14 Jan 2020 16:56:09 +0000
  • Ironport-sdr: KVvVVwttN0anheSBnXLsDsSwWuXmULUxmDYd3DXGchpKGP0rme3CYUEbO5IIyPFt8o4QVAScd5 lWkG1WkId9Oo8laK3yrABhn0AOxx1H2Cw6XLUCCnuEF53Xm1xH+sWxbiu6ukkOzundI+TvIsR1 5xHVB+/mFg82zeDhrYN886/h+m38RZp6Fh4yuKczxYBZHeCzCKZlmn7KqoZibpmsdWeDlRT7Qg 2VuDl/LW51s3JjdTE0rydRir7ciNLUMeFktfmg73LaO7/Y3+sNUoF9ZnBxLXbkwHc5GUiq6Jk8 pic=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Ian Jackson writes ("Re: [PATCH 01/12] libxc/save: Shrink code volume where 
possible"):
> Maybe it would be better to have
>     #define MUST(call) ({ rc = (call); if (rc) goto error; })
> and write
>     MUST( write_one_vcpu_basic(ctx, i) );

This is not uncommon.  BIND9 does something like it:
    
https://git.uis.cam.ac.uk/x/uis/ipreg/bind9.git/blob/HEAD:/lib/dns/zone.c#l515

A friend points out that
  #define MUST(x) ({ int rc_ = (x); if (rc_) { rc = rc_; goto error; } })
is better because it keeps rc uninitialised until the last moment.
That means the compiler can spot exit paths where you fail to set rc.

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.