[PATCH v2 08/21] libtracefs: Make parser unique to libtracefs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Steven Rostedt (VMware)" <rostedt@xxxxxxxxxxx>

Add %define api.prefix and defines to have the parser global variables use
tracefs_* instead of yy*, as without this, if a tool that links to this
library, and tries to use the synth sql parsing, it may end up using its
own yyparse() and friends functions.

Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
---
 src/sqlhist.y         | 10 ++++++++++
 src/tracefs-sqlhist.c |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/sqlhist.y b/src/sqlhist.y
index ce9cb58fb3a9..9d03a457ae84 100644
--- a/src/sqlhist.y
+++ b/src/sqlhist.y
@@ -30,6 +30,16 @@ extern void yyerror(struct sqlhist_bison *, char *fmt, ...);
 %}
 
 %define api.pure
+
+/* Change the globals to use tracefs_ prefix */
+%define api.prefix{tracefs_}
+%code provides
+{
+  #define YYSTYPE TRACEFS_STYPE
+  #define yylex tracefs_lex
+  #define yyerror tracefs_error
+}
+
 %lex-param {void *scanner}
 %parse-param {struct sqlhist_bison *sb}
 
diff --git a/src/tracefs-sqlhist.c b/src/tracefs-sqlhist.c
index e8f77d60659f..933b3609733b 100644
--- a/src/tracefs-sqlhist.c
+++ b/src/tracefs-sqlhist.c
@@ -1021,7 +1021,7 @@ struct tracefs_synth *tracefs_sql(struct tep_handle *tep, const char *name,
 		return NULL;
 	}
 
-	ret = yyparse(&sb);
+	ret = tracefs_parse(&sb);
 	yylex_destroy(sb.scanner);
 
 	if (ret)
-- 
2.30.2




[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux