X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=cql%2Fcql.y;h=e0a2265db381118fdfa11f4604fc7f1a6af33e1d;hb=9c27c751063dfcb13208f2ddc9bf3151a62c0794;hp=582be816940c8a94c6487424f5c817537ca32dc5;hpb=ac286ae76051058c8e340bf84eb98391340b7d22;p=yaz-moved-to-github.git diff --git a/cql/cql.y b/cql/cql.y index 582be81..e0a2265 100644 --- a/cql/cql.y +++ b/cql/cql.y @@ -1,4 +1,4 @@ -/* $Id: cql.y,v 1.3 2003-02-14 18:49:23 adam Exp $ +/* $Id: cql.y,v 1.5 2003-06-04 09:44:05 adam Exp $ Copyright (C) 2002-2003 Index Data Aps @@ -13,14 +13,15 @@ See the file LICENSE. #include #include #include +#include #include typedef struct { struct cql_node *rel; struct cql_node *cql; - char buf[80]; + char *buf; size_t len; - size_t max; + size_t size; } token; struct cql_parser { @@ -30,6 +31,7 @@ See the file LICENSE. int last_error; int last_pos; struct cql_node *top; + NMEM nmem; }; #define YYSTYPE token @@ -242,6 +244,8 @@ int cql_parser_stream(CQL_parser cp, cp->getbyte = getbyte; cp->ungetbyte = ungetbyte; cp->client_data = client_data; + if (cp->top) + cql_node_destroy(cp->top); cql_parse(cp); if (cp->top) return 0; @@ -252,12 +256,20 @@ CQL_parser cql_parser_create(void) { CQL_parser cp = (CQL_parser) malloc (sizeof(*cp)); + cp->top = 0; + cp->getbyte = 0; + cp->ungetbyte = 0; + cp->client_data = 0; + cp->last_error = 0; + cp->last_pos = 0; + cp->nmem = nmem_create(); return cp; } void cql_parser_destroy(CQL_parser cp) { cql_node_destroy(cp->top); + nmem_destroy(cp->nmem); free (cp); }