Eric Blake
2021-Nov-10 18:56 UTC
[Libguestfs] [PATCH libnbd] common/include/checked-overflow.h: Simplify
On Wed, Nov 10, 2021 at 08:49:27PM +0200, Nir Soffer wrote:> We don't need separate macros for size_t and uint64_t since the compiler > builtins are generic. If we need to port to a complier that does not have > generic builtins, it is likely that we can do this in a generic way. > > Signed-off-by: Nir Soffer <nsoffer at redhat.com> > --- > common/include/checked-overflow.h | 18 ++++-------------- > common/utils/vector.c | 10 +++++----- > 2 files changed, 9 insertions(+), 19 deletions(-)ACK. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Richard W.M. Jones
2021-Nov-10 20:07 UTC
[Libguestfs] [PATCH libnbd] common/include/checked-overflow.h: Simplify
On Wed, Nov 10, 2021 at 12:56:26PM -0600, Eric Blake wrote:> On Wed, Nov 10, 2021 at 08:49:27PM +0200, Nir Soffer wrote: > > We don't need separate macros for size_t and uint64_t since the compiler > > builtins are generic. If we need to port to a complier that does not have > > generic builtins, it is likely that we can do this in a generic way. > > > > Signed-off-by: Nir Soffer <nsoffer at redhat.com> > > --- > > common/include/checked-overflow.h | 18 ++++-------------- > > common/utils/vector.c | 10 +++++----- > > 2 files changed, 9 insertions(+), 19 deletions(-) > > ACK.I'll go with what Eric says, particularly because there's an example of this in gnulib (under an incompatible license, so we cannot use it): https://github.com/coreutils/gnulib/blob/50d64b72f2487efcaca6a8b240bc80168e5eb3cb/lib/intprops.h#L389 Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org