From 2af255d6d1850ba7c43ac0c280b7c5a957948c7d Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 15 May 2007 08:52:35 +0000 Subject: [PATCH] Simplify: use wrbuf_cstr to get a NUL-terminated string out. xfree works fine on a NULL ptr. --- src/client.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/client.c b/src/client.c index 0fd5706..05b894f 100644 --- a/src/client.c +++ b/src/client.c @@ -1,4 +1,4 @@ -/* $Id: client.c,v 1.3 2007-05-10 11:46:09 adam Exp $ +/* $Id: client.c,v 1.4 2007-05-15 08:52:35 adam Exp $ Copyright (c) 2006-2007, Index Data. This file is part of Pazpar2. @@ -622,10 +622,8 @@ int client_parse_query(struct client *cl, const char *query) } wrbuf_rewind(se->wrbuf); ccl_pquery(se->wrbuf, cn); - wrbuf_putc(se->wrbuf, '\0'); - if (cl->pquery) - xfree(cl->pquery); - cl->pquery = xstrdup(wrbuf_buf(se->wrbuf)); + xfree(cl->pquery); + cl->pquery = xstrdup(wrbuf_cstr(se->wrbuf)); if (!se->relevance) { -- 1.7.10.4