[libvirt] [PATCH 7/8] examples: Use G_N_ELEMENTS instead of ARRAY_CARDINALITY
Andrea Bolognani
abologna at redhat.com
Tue Oct 15 14:10:55 UTC 2019
On Tue, 2019-10-15 at 14:21 +0200, Ján Tomko wrote:
> We try to keep the example programs independent of libraries
> other than libvirt.
>
> Rename the locally defined ARRAY_CARDINALITY macro to G_N_ELEMENTS
> which GLib provides, even though we don't actually include GLib.
[...]
> -#define ARRAY_CARDINALITY(Array) (sizeof(Array) / sizeof(*(Array)))
> +#define G_N_ELEMENTS(Array) (sizeof(Array) / sizeof(*(Array)))
In this case, and in this case only, I think we should leave the name
alone.
When we use GLib and simply provide our own implementation when using
a version that's too old, the GLib name is obviously accurate, but in
this specific case I think it's misleading and we should stick with
the current one.
--
Andrea Bolognani / Red Hat / Virtualization
More information about the libvir-list
mailing list