xkb: Silence a warning from gcc 11

I get this:

    In function ‘TryCopyStr’,
        inlined from ‘CopyISOLockArgs’ at ../xkb/xkbtext.c:875:9:
    ../xkb/xkbtext.c:720:13: warning: ‘tbuf’ may be used uninitialized [-Wmaybe-uninitialized]
      720 |             strcat(to, from);
          |             ^~~~~~~~~~~~~~~~
    ../xkb/xkbtext.c: In function ‘CopyISOLockArgs’:
    <built-in>: note: by argument 1 of type ‘const char *’ to ‘__builtin_strlen’ declared here
    ../xkb/xkbtext.c:871:10: note: ‘tbuf’ declared here
      871 |     char tbuf[64];
          |          ^~~~

Just initialize tbuf so it definitely works.
This commit is contained in:
Adam Jackson 2021-08-17 16:04:40 -04:00
parent c1138d8ec8
commit b49f0f9b32
1 changed files with 1 additions and 0 deletions

View File

@ -870,6 +870,7 @@ CopyISOLockArgs(XkbDescPtr xkb, XkbAction *action, char *buf, int *sz)
XkbISOAction *act;
char tbuf[64];
memset(tbuf, 0, sizeof(tbuf));
act = &action->iso;
if (act->flags & XkbSA_ISODfltIsGroup) {
TryCopyStr(tbuf, "group=", sz);