From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:57658) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RxeYj-0000gl-Az for qemu-devel@nongnu.org; Wed, 15 Feb 2012 08:06:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RxeYa-0005sg-Dn for qemu-devel@nongnu.org; Wed, 15 Feb 2012 08:06:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54746) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RxeYa-0005sb-3y for qemu-devel@nongnu.org; Wed, 15 Feb 2012 08:06:00 -0500 Date: Wed, 15 Feb 2012 11:05:56 -0200 From: Luiz Capitulino Message-ID: <20120215110556.29af67b9@doriath.home> In-Reply-To: <4F3B7532.6050902@redhat.com> References: <1328902266-25308-1-git-send-email-lcapitulino@redhat.com> <1328902266-25308-5-git-send-email-lcapitulino@redhat.com> <4F3B7532.6050902@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 4/6] Error: Introduce error_copy() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org, quintela@redhat.com On Wed, 15 Feb 2012 10:04:50 +0100 Paolo Bonzini wrote: > On 02/10/2012 08:31 PM, Luiz Capitulino wrote: > > + err_new = g_malloc0(sizeof(*err)); > > + err_new->obj = qdict_copy(err->obj); > > + err_new->msg = g_strdup(err->msg); > > + err_new->fmt = err->fmt; > > + > > + return err_new; > > +} > > Why isn't an incref sufficient? You know, I'm looking at the code right now and can't answer myself that question :-) I think what wanted to do was to duplicate the Error object and just ended up duplicating everything... > QDicts should be constant once they've > been built. I think you meant QErrors? > (Also, I would refcount Errors rather than copy them, but > that's a personal preference and I do not really object to error_copy). The Error object doesn't have refcounts and I'd prefer to just duplicate it for now (instead of adding it).