[evolution-data-server/openismus-work] libedataserver: Don't print warning if e_sexp_parse() fails



commit a61bb1e06bd04a8650f2e7a735a2c80a7bce1b1a
Author: Mathias Hasselmann <mathias openismus com>
Date:   Thu Dec 6 15:40:03 2012 +0100

    libedataserver: Don't print warning if e_sexp_parse() fails
    
    Backends that don't support the full range of queries call e_sexp_parse() with
    their reduced set of symbols to check if they actually can process a query or
    if they must resort to full table scans. If now such a backend is used from
    within a GTest based test this warning causes the test to fail, which obviously
    is bad. Therefore this patch drops the warning in e_sexp_parse() and moves it
    to hopefully more appropriate places.

 addressbook/libebook-contacts/e-book-query.c    |    6 +++++-
 addressbook/libedata-book/e-book-backend-sexp.c |    1 +
 calendar/libedata-cal/e-cal-backend-sexp.c      |    1 +
 libedataserver/e-sexp.c                         |    4 +---
 4 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/addressbook/libebook-contacts/e-book-query.c b/addressbook/libebook-contacts/e-book-query.c
index 232f7b3..12e53f4 100644
--- a/addressbook/libebook-contacts/e-book-query.c
+++ b/addressbook/libebook-contacts/e-book-query.c
@@ -592,7 +592,11 @@ e_book_query_from_string (const gchar *query_string)
 	}
 
 	e_sexp_input_text (sexp, query_string, strlen (query_string));
-	e_sexp_parse (sexp);
+
+	if (e_sexp_parse (sexp)) {
+		g_warning ("%s: Error in parsing: %s", G_STRFUNC, sexp->error);
+		return NULL;
+	}
 
 	r = e_sexp_eval (sexp);
 
diff --git a/addressbook/libedata-book/e-book-backend-sexp.c b/addressbook/libedata-book/e-book-backend-sexp.c
index a6c578e..ef7ae97 100644
--- a/addressbook/libedata-book/e-book-backend-sexp.c
+++ b/addressbook/libedata-book/e-book-backend-sexp.c
@@ -992,6 +992,7 @@ e_book_backend_sexp_new (const gchar *text)
 	esexp_error = e_sexp_parse (sexp->priv->search_sexp);
 
 	if (esexp_error == -1) {
+		g_warning ("%s: Error in parsing: %s", G_STRFUNC, sexp->priv->search_sexp->error);
 		g_object_unref (sexp);
 		sexp = NULL;
 	}
diff --git a/calendar/libedata-cal/e-cal-backend-sexp.c b/calendar/libedata-cal/e-cal-backend-sexp.c
index db9c9e4..e48be23 100644
--- a/calendar/libedata-cal/e-cal-backend-sexp.c
+++ b/calendar/libedata-cal/e-cal-backend-sexp.c
@@ -1626,6 +1626,7 @@ e_cal_backend_sexp_new (const gchar *text)
 	esexp_error = e_sexp_parse (sexp->priv->search_sexp);
 
 	if (esexp_error == -1) {
+		g_warning ("%s: Error in parsing: %s", G_STRFUNC, sexp->priv->search_sexp->error);
 		g_object_unref (sexp);
 		sexp = NULL;
 	}
diff --git a/libedataserver/e-sexp.c b/libedataserver/e-sexp.c
index 0e057a9..67ad75b 100644
--- a/libedataserver/e-sexp.c
+++ b/libedataserver/e-sexp.c
@@ -1672,10 +1672,8 @@ e_sexp_parse (ESExp *f)
 {
 	g_return_val_if_fail (IS_E_SEXP (f), -1);
 
-	if (setjmp (f->failenv)) {
-		g_warning ("Error in parsing: %s", f->error);
+	if (setjmp (f->failenv))
 		return -1;
-	}
 
 	if (f->tree)
 		parse_term_free (f, f->tree);



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