Fix -Werror=maybe-uninitialized

When compiling with `CFLAGS="-O2 -fexceptions -Wp,-D_FORTIFY_SOURCE=2"`, as
done per default when creating an AUR package e.g. via `makepkg`, this
error is produced.

Refactor `stanza_create_mam_iq()` in order to fix said warning-turned-into-
an-error.

Edit by jubalh:
I still think the error message is a false positive. But this commit improves the
code a lot.

Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
This commit is contained in:
Steffen Jaeckel
2023-05-11 12:00:15 +02:00
committed by Michael Vetter
parent 197b839944
commit d8eea87f60
2 changed files with 49 additions and 111 deletions

View File

@@ -47,6 +47,9 @@
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
#define PROF_STRINGIFY_(n) #n
#define PROF_STRINGIFY(n) PROF_STRINGIFY_(n)
void auto_free_gchar(gchar** str);
#define auto_gchar __attribute__((__cleanup__(auto_free_gchar)))
void auto_free_gcharv(gchar*** args);