]> git.ipfire.org Git - pakfire.git/commitdiff
libpakfire: parser: Use our own logging mechanism for error messages
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 9 Mar 2019 18:53:33 +0000 (18:53 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 9 Mar 2019 18:53:33 +0000 (18:53 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/parser/grammar.y

index ef8e32b3db1dd8a120bbd57fb414c95b5368cc66..c8cbd27ed8ae34388a883bfad0d4a0ac3a61db56 100644 (file)
@@ -19,9 +19,6 @@
 #############################################################################*/
 
 %{
-#include <stdio.h>
-#include <stdlib.h>
-
 #include <pakfire/logging.h>
 #include <pakfire/types.h>
 
@@ -33,10 +30,10 @@ extern void yy_delete_buffer(YY_BUFFER_STATE buffer);
 
 extern int yylex();
 extern int yyparse();
-void yyerror(const char* s);
 
 extern int num_lines;
-
+static Pakfire pakfire;
+static void yyerror(const char* s);
 %}
 
 %token APPEND
@@ -55,7 +52,9 @@ top: NEWLINE
 
 %%
 
-int pakfire_parser_parse_metadata(Pakfire pakfire, const char* data, size_t len) {
+int pakfire_parser_parse_metadata(Pakfire _pakfire, const char* data, size_t len) {
+       pakfire = _pakfire;
+
        DEBUG(pakfire, "Parsing the following data:\n%s\n", data);
 
        num_lines = 1;
@@ -68,5 +67,5 @@ int pakfire_parser_parse_metadata(Pakfire pakfire, const char* data, size_t len)
 }
 
 void yyerror(const char* s) {
-       fprintf(stderr, "Error (line %d): %s\n", num_lines, s);
+       ERROR(pakfire, "Error (line %d): %s\n", num_lines, s);
 }