shared: avoid "-Wmaybe-uninitialized" in _char_lookup_has()

shared/nm-glib-aux/nm-shared-utils.c: In function ‘nm_utils_escaped_tokens_escape_full’:
   shared/nm-glib-aux/nm-shared-utils.c:1569:26: error: ‘ch_lookup_as_needed.<U7d10>.table[0]’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
    1569 |  nm_assert (lookup->table[(guint8) 0] == 0);
         |                          ^
   shared/nm-glib-aux/nm-shared-utils.c:1569:26: error: ‘ch_lookup_as_needed.<U7d10>.table[0]’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

Fixes: ae55b98e02 ('shared: add CharLookupTable type for nm_utils_strsplit_set_full()')
This commit is contained in:
Thomas Haller 2020-08-07 11:38:07 +02:00
parent 24c534225f
commit 07264a5dc1
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -1563,8 +1563,13 @@ static gboolean
_char_lookup_has (const CharLookupTable *lookup,
char ch)
{
/* with some optimization levels, the compiler thinks this code
* might access uninitialized @lookup. It is not -- when you look at the
* callers of this function. */
NM_PRAGMA_WARNING_DISABLE ("-Wmaybe-uninitialized")
nm_assert (lookup->table[(guint8) '\0'] == 0);
return lookup->table[(guint8) ch] != 0;
NM_PRAGMA_WARNING_REENABLE
}
static gboolean