[PATCH 10/17] libtracefs: Add a parse_error() helper function to record errors

From: Steven Rostedt
Date: Fri Jul 30 2021 - 18:18:47 EST


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

Add parse_error() that calls into sql_parse_error() with the appropriate
ap argument. That is, parse_error() takes a normal printf() form and then
translates it to the vprintf from of sql_parse_error.

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

diff --git a/src/tracefs-sqlhist.c b/src/tracefs-sqlhist.c
index 887c2441a39e..c0875d630391 100644
--- a/src/tracefs-sqlhist.c
+++ b/src/tracefs-sqlhist.c
@@ -8,6 +8,7 @@
*/
#include <trace-seq.h>
#include <stdlib.h>
+#include <stdarg.h>
#include <errno.h>

#include "tracefs.h"
@@ -153,6 +154,16 @@ __hidden void sql_parse_error(struct sqlhist_bison *sb, const char *text,
trace_seq_destroy(&s);
}

+static void parse_error(struct sqlhist_bison *sb, const char *text,
+ const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ sql_parse_error(sb, text, fmt, ap);
+ va_end(ap);
+}
+
static inline unsigned int quick_hash(const char *str)
{
unsigned int val = 0;
--
2.30.2