Re: [Libguestfs] [PATCH libnbd 1/5] common/utils: Copy simple vector library from nbdkit.

Eric Blake
Tue, 27 Oct 2020 18:48:31 -0000

On 10/27/20 1:38 PM, Richard W.M. Jones wrote:
> This library proved useful in nbdkit where we need to construct an
> array or vector of arbitrary objects, with the easy ability to append
> at the end.  Wherever code uses realloc(3) to build an array of
> objects is a candidate for replacement by this library.
> ---
>  Makefile.am              |   1 +
>  common/utils/Makefile.am |  44 ++++++++++
>  common/utils/vector.c    |  51 +++++++++++
>  common/utils/vector.h    | 177 +++++++++++++++++++++++++++++++++++++++
>  configure.ac             |   1 +
>  5 files changed, 274 insertions(+)
>

> +++ b/common/utils/Makefile.am
> @@ -0,0 +1,44 @@
> +# nbdkit
> +# Copyright (C) 2019 Red Hat Inc.
> +#
> +# Redistribution and use in source and binary forms, with or without
> +# modification, are permitted provided that the following conditions are
> +# met:

Since we are lifting straight from nbdkit, this is fine (our one-way
license conversion at play).  It does mean we have a risk in the
opposite direction (any improvement made here can't easily be pushed
back to nbdkit unless the author is okay with the difference in license).

As long as we are lifting this, should we also list automatic cleanup
usage, where we then demand modern gcc/clang as compiler?

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org