[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v1 01/34] ui: avoid compiler warnings from unused clipboard info
From: |
Alex Bennée |
Subject: |
[PATCH v1 01/34] ui: avoid compiler warnings from unused clipboard info variable |
Date: |
Wed, 5 Jan 2022 13:49:36 +0000 |
From: Daniel P. Berrangé <berrange@redhat.com>
With latest clang 13.0.0 we get
../ui/clipboard.c:47:34: error: variable 'old' set but not used
[-Werror,-Wunused-but-set-variable]
g_autoptr(QemuClipboardInfo) old = NULL;
^
The compiler can't tell that we only declared this variable in
order to get the side effect of free'ing it when out of scope.
This pattern is a little dubious for a use of g_autoptr, so
rewrite the code to avoid it.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
[AJB: fix merge conflict]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20211215141949.3512719-2-berrange@redhat.com>
---
ui/clipboard.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/ui/clipboard.c b/ui/clipboard.c
index 82572ea116..5f15cf853d 100644
--- a/ui/clipboard.c
+++ b/ui/clipboard.c
@@ -62,13 +62,11 @@ void qemu_clipboard_update(QemuClipboardInfo *info)
.type = QEMU_CLIPBOARD_UPDATE_INFO,
.info = info,
};
- g_autoptr(QemuClipboardInfo) old = NULL;
-
assert(info->selection < QEMU_CLIPBOARD_SELECTION__COUNT);
notifier_list_notify(&clipboard_notifiers, ¬ify);
- old = cbinfo[info->selection];
+ qemu_clipboard_info_unref(cbinfo[info->selection]);
cbinfo[info->selection] = qemu_clipboard_info_ref(info);
}
--
2.30.2
- [PATCH v1 00/34] testing/next and other misc fixes, Alex Bennée, 2022/01/05
- [PATCH v1 01/34] ui: avoid compiler warnings from unused clipboard info variable,
Alex Bennée <=
- [PATCH v1 03/34] meson: require liburing >= 0.3, Alex Bennée, 2022/01/05
- [PATCH v1 02/34] spice: Update QXLInterface for spice >= 0.15.0, Alex Bennée, 2022/01/05
- [PATCH v1 08/34] tests/docker: auto-generate centos8.docker with lcitool, Alex Bennée, 2022/01/05
- [PATCH v1 04/34] ui: avoid warnings about directdb on Alpine / musl libc, Alex Bennée, 2022/01/05
- [PATCH v1 06/34] tests/docker: switch fedora image to release 35, Alex Bennée, 2022/01/05
- [PATCH v1 07/34] tests: integrate lcitool for generating build env manifests, Alex Bennée, 2022/01/05
- [PATCH v1 19/34] tests/tcg: use CONFIG_LINUX_USER, not CONFIG_LINUX, Alex Bennée, 2022/01/05
- [PATCH v1 15/34] tests/docker: updates to alpine package list, Alex Bennée, 2022/01/05