• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

コミットメタ情報

リビジョン70a54b01693eda3c61814b05d699aba41015ac48 (tree)
日時2022-01-19 01:42:41
作者Daniel P. Berrangé <berrange@redh...>
コミッターAlex Bennée

ログメッセージ

ui: avoid compiler warnings from unused clipboard info variable

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>
Message-Id: <20220105135009.1584676-2-alex.bennee@linaro.org>

変更サマリ

差分

--- a/ui/clipboard.c
+++ b/ui/clipboard.c
@@ -62,13 +62,11 @@ void qemu_clipboard_update(QemuClipboardInfo *info)
6262 .type = QEMU_CLIPBOARD_UPDATE_INFO,
6363 .info = info,
6464 };
65- g_autoptr(QemuClipboardInfo) old = NULL;
66-
6765 assert(info->selection < QEMU_CLIPBOARD_SELECTION__COUNT);
6866
6967 notifier_list_notify(&clipboard_notifiers, &notify);
7068
71- old = cbinfo[info->selection];
69+ qemu_clipboard_info_unref(cbinfo[info->selection]);
7270 cbinfo[info->selection] = qemu_clipboard_info_ref(info);
7371 }
7472