From nobody Mon Feb 9 20:34:28 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1579794919; cv=none; d=zohomail.com; s=zohoarc; b=Z5ApwGiQceXZMRFX/tQzehgUMT8X79G7GRe7aBo85MN1MpvamKuIrBKA1aOa29Cm/iwgN6J+QGiiOJtBVrbmx4G3b4b4I6NeDzsW2/Fd6NNHqhBvVYpLjNUclH8Dbxv8B/AxXZPARC/+d0WuggBuxIrYtJkY3yQIIo9+5LZqYDI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579794919; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MIVPt6AfB7Si2oRFoeO2RPXJ/HSxWbOijJs6IvacXC4=; b=DIHkFWRPNXVB5mcGja5JUy7z1OciFtt+zbaQmA6HnsH+sfqs6k7z3MJqAXOZHR0iSCtlhulB7WWRz/TLn+7dILzz7X3zB+TEinxuT5nQ5THiWdjVCyVkDqjge6sEsEWkkqtWxukVTsO86CKNKVtjTy/YLJtZdjKbjQ1aAL86U1A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1579794919746695.1821419785258; Thu, 23 Jan 2020 07:55:19 -0800 (PST) Received: from localhost ([::1]:59834 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iuepC-00071g-22 for importer@patchew.org; Thu, 23 Jan 2020 10:55:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51897) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iucrm-0005ad-TQ for qemu-devel@nongnu.org; Thu, 23 Jan 2020 08:49:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iucrl-0004VT-Qg for qemu-devel@nongnu.org; Thu, 23 Jan 2020 08:49:50 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:35787) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iucrl-0004Si-Jz for qemu-devel@nongnu.org; Thu, 23 Jan 2020 08:49:49 -0500 Received: by mail-wm1-x331.google.com with SMTP id p17so2627119wmb.0 for ; Thu, 23 Jan 2020 05:49:49 -0800 (PST) Received: from 640k.localdomain.com ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id s15sm3073171wrp.4.2020.01.23.05.49.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Jan 2020 05:49:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MIVPt6AfB7Si2oRFoeO2RPXJ/HSxWbOijJs6IvacXC4=; b=lIySqjIGpijZ4dJsytu6VCMwAxKpQ5v2GVAVUZbn+bW3fkWMrtSfx9kuRu3XMDaZ92 s5NfXcJX9lMjUcmKEj4DRN/V29TD8Ttn3nQUs/o7SlIeeRDxdKNjdgydOmIhyX7jOeVw i3G0VFA6rMjtBa50l7OxsjT0Ct3yMUau3Lkpvx0sRfEo8eb07gtjMfXXc+BW8n5DnX+3 5PQ9xzbEN8oDGTs8iKUmmAHaQW3ZH6OCOnQ0k9TxH1kuKXfEv+YZvWPIOJAWNY9QwAFU WBgZqL4c1e+dvwj41SkHFg49Jd/1G8W1d3q5KI9Pr/7gGn1UjzR30xrE18sq0//fEOzT uthQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=MIVPt6AfB7Si2oRFoeO2RPXJ/HSxWbOijJs6IvacXC4=; b=V3y5EFQ0WB4mqpuf8TmuNizxFcjYx/qD6sj7X7UfXnml8aKZU1JADoYLFPt0BKIxJg /p2bM8ftJ3eI9b0lVfld1ue/tO3h2SwZybwG7r2cwsjy/Cxzr0UFgdsY/pgJj51ah72p Pavi3uVZwoNFE9WcoiP/9erHMgr+ISH0XkC2gras5cnuK985HjM1QILy0qt4Muqd4m3W hI9rlYJPSafqcMOXzaLBzW6NLbSlfTmMyE5poEbOPiKRvnR9XgmrXrnBxr3AjliMtAjC BXSiwxosOEWhHyUgrClcYTtYqMrYbV8KsS6ydig8dJ736AH/WM0cRNF3lKx07LKxasV4 gC/Q== X-Gm-Message-State: APjAAAVHmMkS8mh4hAZ3EBTLHK3J92x9mDVzQ/tTshhsht19c4TC8Pes WEOZVil4RRw6M1edloHEzXBE5NY8 X-Google-Smtp-Source: APXvYqze5kc9ykXYM8BnoZ3clWESdXoRjAOe6WhscklrehcuAJ78m2JToo+E0pbKDefkz1n+urrw/w== X-Received: by 2002:a7b:cc98:: with SMTP id p24mr4384055wma.139.1579787388489; Thu, 23 Jan 2020 05:49:48 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 48/59] object: return self in object_ref() Date: Thu, 23 Jan 2020 14:48:51 +0100 Message-Id: <1579787342-27146-49-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1579787342-27146-1-git-send-email-pbonzini@redhat.com> References: <1579787342-27146-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::331 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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marc-Andr=C3=A9 Lureau This allow for simpler assignment with ref: foo =3D object_ref(bar) Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200110153039.1379601-19-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- include/qom/object.h | 3 ++- qom/object.c | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index ead9129..933e5c6 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -1013,8 +1013,9 @@ GSList *object_class_get_list_sorted(const char *impl= ements_type, * * Increase the reference count of a object. A object cannot be freed as = long * as its reference count is greater than zero. + * Returns: @obj */ -void object_ref(Object *obj); +Object *object_ref(Object *obj); =20 /** * object_unref: diff --git a/qom/object.c b/qom/object.c index 84d234d..b774507 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1107,12 +1107,13 @@ GSList *object_class_get_list_sorted(const char *im= plements_type, object_class_cmp); } =20 -void object_ref(Object *obj) +Object *object_ref(Object *obj) { if (!obj) { - return; + return NULL; } atomic_inc(&obj->ref); + return obj; } =20 void object_unref(Object *obj) --=20 1.8.3.1