Gitweb links:

...log 
http://git.netsurf-browser.org/libnslog.git/shortlog/87a3522b47394d611e4eb7bb1ba360cff6a939dc
...commit 
http://git.netsurf-browser.org/libnslog.git/commit/87a3522b47394d611e4eb7bb1ba360cff6a939dc
...tree 
http://git.netsurf-browser.org/libnslog.git/tree/87a3522b47394d611e4eb7bb1ba360cff6a939dc

The branch, master has been updated
       via  87a3522b47394d611e4eb7bb1ba360cff6a939dc (commit)
      from  bb14663d67406101a5a4b5afbf9588d813f12656 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/libnslog.git/commit/?id=87a3522b47394d611e4eb7bb1ba360cff6a939dc
commit 87a3522b47394d611e4eb7bb1ba360cff6a939dc
Author: Daniel Silverstone <[email protected]>
Commit: Daniel Silverstone <[email protected]>

    Fix up some parser snafu for release mode

diff --git a/Makefile b/Makefile
index 26cf49f..5c9c7b8 100644
--- a/Makefile
+++ b/Makefile
@@ -32,7 +32,7 @@ else
   # __inline__ is a GCCism
   CFLAGS := $(CFLAGS) -Dinline="__inline__"
 endif
-CFLAGS := $(CFLAGS) -D_POSIX_C_SOURCE=200809L
+CFLAGS := $(CFLAGS) -D_POSIX_C_SOURCE=200809L -g
 
 REQUIRED_LIBS := nslog
 
diff --git a/src/filter-parser.y b/src/filter-parser.y
index bb225b6..2ccb3c8 100644
--- a/src/filter-parser.y
+++ b/src/filter-parser.y
@@ -33,6 +33,10 @@ static void filter_error(FILTER_LTYPE *loc, nslog_filter_t 
**output, const char
        nslog_filter_t *filter;
 }
 
+%destructor {
+       nslog_filter_unref($$);
+} <filter>
+
 %token <patt> T_PATTERN
 %token <level> T_LEVEL
 
@@ -88,35 +92,45 @@ expression ::= term | '!' term
 level_filter:
        T_LEVEL_SPECIFIER T_LEVEL
        {
-               assert(nslog_filter_level_new($2, &$$) == NSLOG_NO_ERROR);
+               if (nslog_filter_level_new($2, &$$) != NSLOG_NO_ERROR) {
+                       YYABORT ;
+               }
        }
        ;
 
 category_filter:
        T_CATEGORY_SPECIFIER T_PATTERN
        {
-               assert(nslog_filter_category_new($2, &$$) == NSLOG_NO_ERROR);
+               if (nslog_filter_category_new($2, &$$) != NSLOG_NO_ERROR) {
+                       YYABORT ;
+               }
        }
        ;
 
 filename_filter:
        T_FILENAME_SPECIFIER T_PATTERN
        {
-               assert(nslog_filter_filename_new($2, &$$) == NSLOG_NO_ERROR);
+               if (nslog_filter_filename_new($2, &$$) != NSLOG_NO_ERROR) {
+                       YYABORT ;
+               }
        }
        ;
 
 dirname_filter:
        T_DIRNAME_SPECIFIER T_PATTERN
        {
-               assert(nslog_filter_dirname_new($2, &$$) == NSLOG_NO_ERROR);
+               if (nslog_filter_dirname_new($2, &$$) != NSLOG_NO_ERROR) {
+                       YYABORT ;
+               }
        }
        ;
 
 funcname_filter:
        T_FUNCNAME_SPECIFIER T_PATTERN
        {
-               assert(nslog_filter_funcname_new($2, &$$) == NSLOG_NO_ERROR);
+               if (nslog_filter_funcname_new($2, &$$) != NSLOG_NO_ERROR) {
+                       YYABORT ;
+               }
        }
        ;
 
@@ -135,7 +149,11 @@ basic_filter:
 and_filter:
        '(' filter T_OP_AND filter ')'
        {
-               assert(nslog_filter_and_new($2, $4, &$$) == NSLOG_NO_ERROR);
+               if (nslog_filter_and_new($2, $4, &$$) != NSLOG_NO_ERROR) {
+                       nslog_filter_unref($2);
+                       nslog_filter_unref($4);
+                       YYABORT ;
+               }
                nslog_filter_unref($2);
                nslog_filter_unref($4);
        }
@@ -144,7 +162,11 @@ and_filter:
 or_filter:
        '(' filter T_OP_OR filter ')'
        {
-               assert(nslog_filter_or_new($2, $4, &$$) == NSLOG_NO_ERROR);
+               if (nslog_filter_or_new($2, $4, &$$) != NSLOG_NO_ERROR) {
+                       nslog_filter_unref($2);
+                       nslog_filter_unref($4);
+                       YYABORT ;
+               }
                nslog_filter_unref($2);
                nslog_filter_unref($4);
        }
@@ -153,7 +175,11 @@ or_filter:
 xor_filter:
        '(' filter '^' filter ')'
        {
-               assert(nslog_filter_xor_new($2, $4, &$$) == NSLOG_NO_ERROR);
+               if (nslog_filter_xor_new($2, $4, &$$) != NSLOG_NO_ERROR) {
+                       nslog_filter_unref($2);
+                       nslog_filter_unref($4);
+                       YYABORT ;
+               }
                nslog_filter_unref($2);
                nslog_filter_unref($4);
        }
@@ -170,7 +196,10 @@ binary_filter:
 not_filter:
        '!' filter
        {
-               assert(nslog_filter_not_new($2, &$$) == NSLOG_NO_ERROR);
+               if (nslog_filter_not_new($2, &$$) != NSLOG_NO_ERROR) {
+                       nslog_filter_unref($2);
+                       YYABORT ;
+               }
                nslog_filter_unref($2);
        }
        ;
@@ -186,7 +215,7 @@ filter:
 toplevel:
        filter
        {
-               $$ = *output = $1;
+               $$ = *output = nslog_filter_ref($1);
        }
        |
        error
diff --git a/test/basictests.c b/test/basictests.c
index a9b8ab0..b03bd7b 100644
--- a/test/basictests.c
+++ b/test/basictests.c
@@ -279,9 +279,11 @@ END_TEST
 
 START_TEST (test_nslog_parse_and_sprintf)
 {
-       nslog_filter_t *filt;
+       nslog_filter_t *filt = NULL;
        fail_unless(nslog_filter_from_text("cat:test", &filt) == NSLOG_NO_ERROR,
                    "Unable to parse cat:test");
+       fail_unless(filt != NULL,
+                   "Strange, despite parsing okay, filt was NULL");
        char *ct = nslog_filter_sprintf(filt);
        nslog_filter_unref(filt);
        fail_unless(strcmp(ct, "cat:test") == 0,


-----------------------------------------------------------------------

Summary of changes:
 Makefile            |    2 +-
 src/filter-parser.y |   49 +++++++++++++++++++++++++++++++++++++++----------
 test/basictests.c   |    4 +++-
 3 files changed, 43 insertions(+), 12 deletions(-)

diff --git a/Makefile b/Makefile
index 26cf49f..5c9c7b8 100644
--- a/Makefile
+++ b/Makefile
@@ -32,7 +32,7 @@ else
   # __inline__ is a GCCism
   CFLAGS := $(CFLAGS) -Dinline="__inline__"
 endif
-CFLAGS := $(CFLAGS) -D_POSIX_C_SOURCE=200809L
+CFLAGS := $(CFLAGS) -D_POSIX_C_SOURCE=200809L -g
 
 REQUIRED_LIBS := nslog
 
diff --git a/src/filter-parser.y b/src/filter-parser.y
index bb225b6..2ccb3c8 100644
--- a/src/filter-parser.y
+++ b/src/filter-parser.y
@@ -33,6 +33,10 @@ static void filter_error(FILTER_LTYPE *loc, nslog_filter_t 
**output, const char
        nslog_filter_t *filter;
 }
 
+%destructor {
+       nslog_filter_unref($$);
+} <filter>
+
 %token <patt> T_PATTERN
 %token <level> T_LEVEL
 
@@ -88,35 +92,45 @@ expression ::= term | '!' term
 level_filter:
        T_LEVEL_SPECIFIER T_LEVEL
        {
-               assert(nslog_filter_level_new($2, &$$) == NSLOG_NO_ERROR);
+               if (nslog_filter_level_new($2, &$$) != NSLOG_NO_ERROR) {
+                       YYABORT ;
+               }
        }
        ;
 
 category_filter:
        T_CATEGORY_SPECIFIER T_PATTERN
        {
-               assert(nslog_filter_category_new($2, &$$) == NSLOG_NO_ERROR);
+               if (nslog_filter_category_new($2, &$$) != NSLOG_NO_ERROR) {
+                       YYABORT ;
+               }
        }
        ;
 
 filename_filter:
        T_FILENAME_SPECIFIER T_PATTERN
        {
-               assert(nslog_filter_filename_new($2, &$$) == NSLOG_NO_ERROR);
+               if (nslog_filter_filename_new($2, &$$) != NSLOG_NO_ERROR) {
+                       YYABORT ;
+               }
        }
        ;
 
 dirname_filter:
        T_DIRNAME_SPECIFIER T_PATTERN
        {
-               assert(nslog_filter_dirname_new($2, &$$) == NSLOG_NO_ERROR);
+               if (nslog_filter_dirname_new($2, &$$) != NSLOG_NO_ERROR) {
+                       YYABORT ;
+               }
        }
        ;
 
 funcname_filter:
        T_FUNCNAME_SPECIFIER T_PATTERN
        {
-               assert(nslog_filter_funcname_new($2, &$$) == NSLOG_NO_ERROR);
+               if (nslog_filter_funcname_new($2, &$$) != NSLOG_NO_ERROR) {
+                       YYABORT ;
+               }
        }
        ;
 
@@ -135,7 +149,11 @@ basic_filter:
 and_filter:
        '(' filter T_OP_AND filter ')'
        {
-               assert(nslog_filter_and_new($2, $4, &$$) == NSLOG_NO_ERROR);
+               if (nslog_filter_and_new($2, $4, &$$) != NSLOG_NO_ERROR) {
+                       nslog_filter_unref($2);
+                       nslog_filter_unref($4);
+                       YYABORT ;
+               }
                nslog_filter_unref($2);
                nslog_filter_unref($4);
        }
@@ -144,7 +162,11 @@ and_filter:
 or_filter:
        '(' filter T_OP_OR filter ')'
        {
-               assert(nslog_filter_or_new($2, $4, &$$) == NSLOG_NO_ERROR);
+               if (nslog_filter_or_new($2, $4, &$$) != NSLOG_NO_ERROR) {
+                       nslog_filter_unref($2);
+                       nslog_filter_unref($4);
+                       YYABORT ;
+               }
                nslog_filter_unref($2);
                nslog_filter_unref($4);
        }
@@ -153,7 +175,11 @@ or_filter:
 xor_filter:
        '(' filter '^' filter ')'
        {
-               assert(nslog_filter_xor_new($2, $4, &$$) == NSLOG_NO_ERROR);
+               if (nslog_filter_xor_new($2, $4, &$$) != NSLOG_NO_ERROR) {
+                       nslog_filter_unref($2);
+                       nslog_filter_unref($4);
+                       YYABORT ;
+               }
                nslog_filter_unref($2);
                nslog_filter_unref($4);
        }
@@ -170,7 +196,10 @@ binary_filter:
 not_filter:
        '!' filter
        {
-               assert(nslog_filter_not_new($2, &$$) == NSLOG_NO_ERROR);
+               if (nslog_filter_not_new($2, &$$) != NSLOG_NO_ERROR) {
+                       nslog_filter_unref($2);
+                       YYABORT ;
+               }
                nslog_filter_unref($2);
        }
        ;
@@ -186,7 +215,7 @@ filter:
 toplevel:
        filter
        {
-               $$ = *output = $1;
+               $$ = *output = nslog_filter_ref($1);
        }
        |
        error
diff --git a/test/basictests.c b/test/basictests.c
index a9b8ab0..b03bd7b 100644
--- a/test/basictests.c
+++ b/test/basictests.c
@@ -279,9 +279,11 @@ END_TEST
 
 START_TEST (test_nslog_parse_and_sprintf)
 {
-       nslog_filter_t *filt;
+       nslog_filter_t *filt = NULL;
        fail_unless(nslog_filter_from_text("cat:test", &filt) == NSLOG_NO_ERROR,
                    "Unable to parse cat:test");
+       fail_unless(filt != NULL,
+                   "Strange, despite parsing okay, filt was NULL");
        char *ct = nslog_filter_sprintf(filt);
        nslog_filter_unref(filt);
        fail_unless(strcmp(ct, "cat:test") == 0,


-- 
NetSurf Parametric Logging Library

_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to