[PATCH] Use G_N_ELEMENTS() more

Kristina Hanicova khanicov at redhat.com
Mon Mar 13 12:18:50 UTC 2023


On Mon, Mar 13, 2023 at 12:57 PM Michal Privoznik <mprivozn at redhat.com>
wrote:

> In a few places we still use the good old:
>
>   sizeof(var) / sizeof(var[0])
>   sizeof(var) / sizeof(int)
>
> The G_N_ELEMENTS() macro is preferred though. In a few places we
> don't link with glib, so provide the macro definition.
>
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  examples/c/misc/openauth.c | 4 +++-
>  src/libvirt.c              | 2 +-
>  tests/virbitmaptest.c      | 4 ++--
>  tests/virnetdevtest.c      | 8 ++++----
>  tools/nss/libvirt_nss.c    | 3 ++-
>  tools/virt-login-shell.c   | 3 ++-
>  6 files changed, 14 insertions(+), 10 deletions(-)
>


Reviewed-by: Kristina Hanicova <khanicov at redhat.com>

Kristina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20230313/f5ed743b/attachment.htm>


More information about the libvir-list mailing list