From 21209bd0403729bb35389844d9f37264918bcf8a Mon Sep 17 00:00:00 2001 From: Julien BLACHE Date: Fri, 24 Apr 2009 11:12:58 +0200 Subject: [PATCH] Make sp_parse() second argument (term) const The term (filter) argument is strdup()'d and that copy gets destroyed by the parsing. --- src/smart-parser.c | 2 +- src/smart-parser.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/smart-parser.c b/src/smart-parser.c index de9885b0..795d637e 100644 --- a/src/smart-parser.c +++ b/src/smart-parser.c @@ -710,7 +710,7 @@ PARSETREE sp_init(void) { * @param term term or phrase to parse * @returns 1 if successful, 0 if not */ -int sp_parse(PARSETREE tree, char *term, int type) { +int sp_parse(PARSETREE tree, const char *term, int type) { tree->term = strdup(term); /* will be destroyed by parsing */ tree->current=tree->term; tree->token.token_id=T_BOF; diff --git a/src/smart-parser.h b/src/smart-parser.h index d4421ee4..2b32256f 100644 --- a/src/smart-parser.h +++ b/src/smart-parser.h @@ -5,7 +5,7 @@ typedef void* PARSETREE; extern PARSETREE sp_init(void); -extern int sp_parse(PARSETREE tree, char *term, int type); +extern int sp_parse(PARSETREE tree, const char *term, int type); extern int sp_dispose(PARSETREE tree); extern char *sp_get_error(PARSETREE tree); extern char *sp_sql_clause(PARSETREE tree);