From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kelley Nielsen Subject: [PATCH OPW 7/7] libxl: use LOG instead of LIBXL__LOG in libxl_utils.c Date: Mon, 11 Nov 2013 07:50:14 -0800 Message-ID: <1384185014-30342-8-git-send-email-kelleynnn@gmail.com> References: <1384185014-30342-1-git-send-email-kelleynnn@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1384185014-30342-1-git-send-email-kelleynnn@gmail.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: xen-devel@lists.xensource.com Cc: anthony.perard@citrix.com, Ian.Campbell@citrix.com List-Id: xen-devel@lists.xenproject.org To conform to the new coding style, replace the invocation of LIBXL__LOG in the function libxl_pipe() in the file libxl_utils.c with an invocation of LOG. Create a local libxl__gc gc* for LOG to use by invoking GC_INIT(ctx) at the top of the function, and clean it up by invoking GC_FREE at the exit. Create a variable, ret, to consolidate exits in one place and avoid invoking GC_FREE twice. Suggested-by: Ian Campbell Signed-off-by: Kelley Nielsen Acked-by: Ian Campbell --- tools/libxl/libxl_utils.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c index 5ed9e1b..4c5f754 100644 --- a/tools/libxl/libxl_utils.c +++ b/tools/libxl/libxl_utils.c @@ -477,11 +477,14 @@ int libxl__remove_directory(libxl__gc *gc, const char *dirpath) int libxl_pipe(libxl_ctx *ctx, int pipes[2]) { + GC_INIT(ctx); + int ret = 0; if (pipe(pipes) < 0) { - LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Failed to create a pipe"); - return -1; + LOG(ERROR, "Failed to create a pipe"); + ret = -1; } - return 0; + GC_FREE; + return ret; } int libxl_uuid_to_device_vtpm(libxl_ctx *ctx, uint32_t domid, -- 1.8.1.2