From: Ian Campbell Subject: Re: [PATCH v2] libxl: refactor toolstack save restore code Date: Wed, 17 Jun 2015 14:34:21 +0100 Message-ID: <1434548061.13744.387.camel@citrix.com> References: <1434539318-1106-1-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Z5DUZ-0001fO-BD for xen-devel@lists.xenproject.org; Wed, 17 Jun 2015 13:34:59 +0000 In-Reply-To: <1434539318-1106-1-git-send-email-wei.liu2@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wei Liu Cc: Xen-devel , Ian Jackson , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Wed, 2015-06-17 at 12:08 +0100, Wei Liu wrote: > This patch does following things: > 1. Document v1 format. > 2. Factor out function to handle QEMU restore data and function to > handle v1 blob for restore path. > 3. Refactor save function to generate different blobs in the order > specified in format specification. > 4. Change functions to use "goto out" idiom. > > No functional changes introduced. > > Signed-off-by: Wei Liu [...] > - *len = sizeof(version) + sizeof(count); > + /* Version number */ > + *len = sizeof(version); > *buf = calloc(1, *len); This ought to use lbixl__calloc and therefore avoid the error handling, and possibly the cleanup by taking advantage of the gc. [...] > + *len += sizeof(count); > + *buf = realloc(*buf, *len); As should this use libxl__realloc. But those are out of scope for what you are doing (it just gets more obvious with the goto out idiom I think), so: Acked + applied.