aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--e-util/ChangeLog5
-rw-r--r--e-util/e-sexp.c29
2 files changed, 24 insertions, 10 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog
index c22a4434ed..0106465b72 100644
--- a/e-util/ChangeLog
+++ b/e-util/ChangeLog
@@ -1,3 +1,8 @@
+2001-06-15 Not Zed <NotZed@Ximian.com>
+
+ * e-sexp.c (parse_values): REmove a silly hardcoded term limit,
+ oops forgot about that.
+
2001-06-11 Damon Chaplin <damon@ximian.com>
* e-time-utils.c (e_time_parse_date_and_time): skip any non-digits
diff --git a/e-util/e-sexp.c b/e-util/e-sexp.c
index 4ba42cb336..af319aa2dc 100644
--- a/e-util/e-sexp.c
+++ b/e-util/e-sexp.c
@@ -654,7 +654,7 @@ e_sexp_term_eval(struct _ESExp *f, struct _ESExpTerm *t)
return r;
}
-#if 0
+#ifdef TESTER
static void
eval_dump_result(ESExpResult *r, int depth)
{
@@ -790,24 +790,33 @@ parse_values(ESExp *f, int *len)
{
int token;
struct _ESExpTerm **terms;
- int i=0;
+ int i, size = 0;
GScanner *gs = f->scanner;
+ GSList *list = NULL, *l;
p(printf("parsing values\n"));
- /* FIXME: This hardcoded nonsense!!! :) */
- terms = g_malloc0(30*sizeof(*terms));
-
while ( (token = g_scanner_peek_next_token(gs)) != G_TOKEN_EOF
&& token != ')') {
- terms[i]=parse_value(f);
- i++;
+ list = g_slist_prepend(list, parse_value(f));
+ size++;
+ }
+
+ /* go over the list, and put them backwards into the term array */
+ terms = g_malloc(size * sizeof(*terms));
+ l = list;
+ for (i=size-1;i>=0;i--) {
+ g_assert(l);
+ g_assert(l->data);
+ terms[i] = l->data;
+ l = g_slist_next(l);
}
+ g_slist_free(list);
- p(printf("found %d subterms\n", i));
- *len = i;
+ p(printf("found %d subterms\n", size));
+ *len = size;
- p(printf("dont parsing values\n"));
+ p(printf("done parsing values\n"));
return terms;
}