From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Me3NS-0004vq-QN for qemu-devel@nongnu.org; Thu, 20 Aug 2009 04:52:10 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Me3NN-0004tv-C1 for qemu-devel@nongnu.org; Thu, 20 Aug 2009 04:52:09 -0400 Received: from [199.232.76.173] (port=55878 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Me3NM-0004tf-Rm for qemu-devel@nongnu.org; Thu, 20 Aug 2009 04:52:04 -0400 Received: from mail-ew0-f223.google.com ([209.85.219.223]:51817) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Me3NM-0003aW-DH for qemu-devel@nongnu.org; Thu, 20 Aug 2009 04:52:04 -0400 Received: by ewy23 with SMTP id 23so5230447ewy.8 for ; Thu, 20 Aug 2009 01:52:02 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4A8D0EAE.2020608@gnu.org> Date: Thu, 20 Aug 2009 10:51:58 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1250723280-3509-1-git-send-email-lcapitulino@redhat.com> <1250723280-3509-2-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1250723280-3509-2-git-send-email-lcapitulino@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 01/29] Introduce QObject List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org, avi@redhat.com > + * - New reference: means that the caller is now the owner of a reference, > + * for example, if you call a function that returns a 'new reference' you > + * must call QDECREF() when you are done > + * > + * - Borrowing a reference: nothing needs to be done, you are not the > + * owner of the reference > + * > + * - Stealing a reference: when you pass a reference to a function that > + * 'steals a reference' this function assumes that it now owns that > + * reference I think the usual terms used here would be like - Returning references: A function that returns an object may return it as either a weak or a strong reference. If the reference is strong, you are responsible for calling QDECREF() on the reference when you are done. If the reference is weak, the owner of the reference may free it at any time in the future. Before storing the reference anywhere, you should call QINCREF() to make the reference strong. - Transferring ownership: when you transfer ownership of a reference by calling a function, you are no longer responsible for calling QDECREF() when the reference is no longer needed. In other words, when the function returns you must behave as if the reference to the passed object was weak. I'll post examples of using this terminology in the review of QDict. Paolo