Re: [xml] "double"s and schema validation

On Thu, 22 Jul 2010 14:38:16 +0200, Csaba Raduly wrote:

Anyway, here's a revised version:
--- xmlschemastypes2.c  2010-07-21 13:17:12.229467800 +0200 +++
xmlschemastypes.c   2010-07-22 14:00:05.965759600 +0200 @@ -2392,6
+2392,8 @@
         case XML_SCHEMAS_DOUBLE:{
                 const xmlChar *cur = value;
                 int neg = 0;
+                int digits_before = 0;
+                int digits_after  = 0;

There's no need for two counters.  Just use the same counter inside both 
loops and check for that counter being zero (or non-zero) at the end 
(then again, a sufficiently clever optimizer may already be doing that 
for you).  IMO, that fits the spirit of "a finite-length sequence of 
decimal digits separated by a period" fairly well.

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