shared: fix generic selection of integers in nm_strdup_int()

This fixes a test error, which aims to convert "unsigned long int" type,
but the generic type may not have been covered.

Don't select based on the gint32-like typedefs, but on the basic C
integer types.

Fixes: 8c2d58b237

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/issues/108
This commit is contained in:
Thomas Haller 2019-01-16 15:44:11 +01:00
parent 3409a9750c
commit e7e0100062

View file

@ -304,17 +304,19 @@ _nm_strndup_a_step (char *s, const char *str, gsize len)
#if _NM_CC_SUPPORT_GENERIC
#define nm_strdup_int(val) \
_Generic ((val), \
char: g_strdup_printf ("%d", (int) (val)), \
char: g_strdup_printf ("%d", (int) (val)), \
\
gint8: g_strdup_printf ("%d", (int) (val)), \
gint16: g_strdup_printf ("%d", (int) (val)), \
gint32: g_strdup_printf ("%d", (int) (val)), \
gint64: g_strdup_printf ("%"G_GINT64_FORMAT, (gint64) (val)), \
signed char: g_strdup_printf ("%d", (signed) (val)), \
signed short: g_strdup_printf ("%d", (signed) (val)), \
signed: g_strdup_printf ("%d", (signed) (val)), \
signed long: g_strdup_printf ("%ld", (signed long) (val)), \
signed long long: g_strdup_printf ("%lld", (signed long long) (val)), \
\
guint8: g_strdup_printf ("%u", (guint) (val)), \
guint16: g_strdup_printf ("%u", (guint) (val)), \
guint32: g_strdup_printf ("%u", (guint) (val)), \
guint64: g_strdup_printf ("%"G_GUINT64_FORMAT, (guint64) (val)) \
unsigned char: g_strdup_printf ("%u", (unsigned) (val)), \
unsigned short: g_strdup_printf ("%u", (unsigned) (val)), \
unsigned: g_strdup_printf ("%u", (unsigned) (val)), \
unsigned long: g_strdup_printf ("%lu", (unsigned long) (val)), \
unsigned long long: g_strdup_printf ("%llu", (unsigned long long) (val)) \
)
#else
#define nm_strdup_int(val) \