src: initialize keymaps variable
My clang version 11.0.0 (Fedora 11.0.0-2.fc33) complains:
../src/virt-viewer-app.c:610:9: error: variable 'keymaps' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
if (keymap_string) {
^~~~~~~~~~~~~
../src/virt-viewer-app.c:614:10: note: uninitialized use occurs here
if (!keymaps || g_strv_length(keymaps) == 0) {
^~~~~~~
../src/virt-viewer-app.c:610:5: note: remove the 'if' if its condition is always true
if (keymap_string) {
^~~~~~~~~~~~~~~~~~~
../src/virt-viewer-app.c:595:27: note: initialize the variable 'keymaps' to silence this warning
gchar **key, **keymaps, **valkey, **valuekeys = NULL;
^
= NULL
1 error generated.
Initialize the variable to fix the uninitialized use.
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Ján Tomko
3 years ago
591 | 591 | void virt_viewer_app_set_keymap(VirtViewerApp *self, const gchar *keymap_string) |
592 | 592 | { |
593 | 593 | VirtViewerAppPrivate *priv = virt_viewer_app_get_instance_private(self); |
594 | gchar **key, **keymaps, **valkey, **valuekeys = NULL; | |
594 | gchar **key, **keymaps = NULL, **valkey, **valuekeys = NULL; | |
595 | 595 | VirtViewerKeyMapping *keyMappingArray, *keyMappingPtr; |
596 | 596 | guint *mappedArray, *ptrMove; |
597 | 597 |