[Gnucash-changes] r13243 - gnucash/trunk/src/calculation - Don't continue to parse the expression if we've already reached the end.

Chris Shoemaker chris at cvs.gnucash.org
Sun Feb 12 15:31:12 EST 2006


Author: chris
Date: 2006-02-12 15:31:11 -0500 (Sun, 12 Feb 2006)
New Revision: 13243
Trac: http://svn.gnucash.org/trac/changeset/13243

Modified:
   gnucash/trunk/src/calculation/expression_parser.c
Log:
   Don't continue to parse the expression if we've already reached the end.
   Fixes http://bugzilla.gnome.org/show_bug.cgi?id=166840.


Modified: gnucash/trunk/src/calculation/expression_parser.c
===================================================================
--- gnucash/trunk/src/calculation/expression_parser.c	2006-02-12 20:29:05 UTC (rev 13242)
+++ gnucash/trunk/src/calculation/expression_parser.c	2006-02-12 20:31:11 UTC (rev 13243)
@@ -363,7 +363,7 @@
  * Note: The parser/evaluator uses a simple recursive descent
  * parser. I decided on this type for the simple reason that for a
  * simple four function calculator a recursive descent parser is, in
- * my opnion, the easiest to construct. I also think that recursive
+ * my opinion, the easiest to construct. I also think that recursive
  * descent parsers are easier for the human to understand and thus
  * maintain.
  *
@@ -751,8 +751,11 @@
 static void
 add_token (parser_env_ptr pe, char token)
 {
-  *pe->token_tail = pe->Token = token;
-  pe->token_tail++;
+    pe->Token = token;
+    if ((token != EOS) || (*pe->token_tail != EOS)) {
+        *pe->token_tail = token;
+        pe->token_tail++;
+    }
 }
 
 /* parse next token from string */



More information about the gnucash-changes mailing list