From: Adam Dickmeiss Date: Tue, 15 May 2007 08:52:35 +0000 (+0000) Subject: Simplify: use wrbuf_cstr to get a NUL-terminated string out. xfree works X-Git-Tag: PAZPAR2.1.0.0~146 X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=commitdiff_plain;h=2af255d6d1850ba7c43ac0c280b7c5a957948c7d;p=pazpar2-moved-to-github.git Simplify: use wrbuf_cstr to get a NUL-terminated string out. xfree works fine on a NULL ptr. --- 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) {