From patchwork Wed Dec 18 08:17:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 11299875 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4F6A014F6 for ; Wed, 18 Dec 2019 08:21:23 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2505D21D7D for ; Wed, 18 Dec 2019 08:21:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="FcS0nMhC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2505D21D7D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:50950 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihUa9-00034n-SY for patchwork-qemu-devel@patchwork.kernel.org; Wed, 18 Dec 2019 03:21:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35590) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihUWT-0005yh-Ae for qemu-devel@nongnu.org; Wed, 18 Dec 2019 03:17:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihUWR-0002TA-Fd for qemu-devel@nongnu.org; Wed, 18 Dec 2019 03:17:32 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:22262 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ihUWQ-0002Qf-Rw for qemu-devel@nongnu.org; Wed, 18 Dec 2019 03:17:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576657049; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qFYCZKR/a0tM8e6dHaEcw7hFOz0p6BlQSbWjBry2PJw=; b=FcS0nMhCpyACsyJ5h4nROQgWepO7+uBkcweNQkcnA7wil4zUeCQvUIf4ABcxGvYhO67wki +Y+7/9F1ReFukNAJJZVrb/+/eIt+PzBhL5ZK6ORH0ikOwTVPwfzM5ZNaT8+NY9EtwJy093 roiVOOajOGHqJxDVD41uW6DCT9BLTPY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-47-NXx13aaIMgKEGeY8cnz_YQ-1; Wed, 18 Dec 2019 03:17:28 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 03D44DB22; Wed, 18 Dec 2019 08:17:27 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-42.ams2.redhat.com [10.36.116.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CE5F31001281; Wed, 18 Dec 2019 08:17:25 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 997201136422; Wed, 18 Dec 2019 09:17:21 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL v2 18/35] vnc: drop Error pointer indirection in vnc_client_io_error Date: Wed, 18 Dec 2019 09:17:04 +0100 Message-Id: <20191218081721.23520-19-armbru@redhat.com> In-Reply-To: <20191218081721.23520-1-armbru@redhat.com> References: <20191218081721.23520-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: NXx13aaIMgKEGeY8cnz_YQ-1 X-Mimecast-Spam-Score: 0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vladimir Sementsov-Ogievskiy , =?utf-8?q?Phili?= =?utf-8?q?ppe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Vladimir Sementsov-Ogievskiy We don't need Error **, as all callers pass local Error object, which isn't used after the call, or NULL. Use Error * instead. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Markus Armbruster Message-Id: <20191205174635.18758-6-vsementsov@virtuozzo.com> Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Markus Armbruster --- ui/vnc.h | 2 +- ui/vnc.c | 20 +++++++------------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/ui/vnc.h b/ui/vnc.h index fea79c2fc9..4e2637ce6c 100644 --- a/ui/vnc.h +++ b/ui/vnc.h @@ -547,7 +547,7 @@ uint32_t read_u32(uint8_t *data, size_t offset); /* Protocol stage functions */ void vnc_client_error(VncState *vs); -size_t vnc_client_io_error(VncState *vs, ssize_t ret, Error **errp); +size_t vnc_client_io_error(VncState *vs, ssize_t ret, Error *err); void start_client_init(VncState *vs); void start_auth_vnc(VncState *vs); diff --git a/ui/vnc.c b/ui/vnc.c index 87b8045afe..4100d6e404 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -1312,7 +1312,7 @@ void vnc_disconnect_finish(VncState *vs) g_free(vs); } -size_t vnc_client_io_error(VncState *vs, ssize_t ret, Error **errp) +size_t vnc_client_io_error(VncState *vs, ssize_t ret, Error *err) { if (ret <= 0) { if (ret == 0) { @@ -1320,15 +1320,11 @@ size_t vnc_client_io_error(VncState *vs, ssize_t ret, Error **errp) vnc_disconnect_start(vs); } else if (ret != QIO_CHANNEL_ERR_BLOCK) { trace_vnc_client_io_error(vs, vs->ioc, - errp ? error_get_pretty(*errp) : - "Unknown"); + err ? error_get_pretty(err) : "Unknown"); vnc_disconnect_start(vs); } - if (errp) { - error_free(*errp); - *errp = NULL; - } + error_free(err); return 0; } return ret; @@ -1361,10 +1357,9 @@ size_t vnc_client_write_buf(VncState *vs, const uint8_t *data, size_t datalen) { Error *err = NULL; ssize_t ret; - ret = qio_channel_write( - vs->ioc, (const char *)data, datalen, &err); + ret = qio_channel_write(vs->ioc, (const char *)data, datalen, &err); VNC_DEBUG("Wrote wire %p %zd -> %ld\n", data, datalen, ret); - return vnc_client_io_error(vs, ret, &err); + return vnc_client_io_error(vs, ret, err); } @@ -1488,10 +1483,9 @@ size_t vnc_client_read_buf(VncState *vs, uint8_t *data, size_t datalen) { ssize_t ret; Error *err = NULL; - ret = qio_channel_read( - vs->ioc, (char *)data, datalen, &err); + ret = qio_channel_read(vs->ioc, (char *)data, datalen, &err); VNC_DEBUG("Read wire %p %zd -> %ld\n", data, datalen, ret); - return vnc_client_io_error(vs, ret, &err); + return vnc_client_io_error(vs, ret, err); }