Update of /cvsroot/monetdb/MonetDB5/src/modules/mal
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv23930/src/modules/mal

Modified Files:
        tablet.mx 
Log Message:

make sure we only skip whitespace if seperators aren't whitespace



Index: tablet.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/modules/mal/tablet.mx,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -d -r1.103 -r1.104
--- tablet.mx   15 Oct 2007 15:26:03 -0000      1.103
+++ tablet.mx   23 Oct 2007 21:53:08 -0000      1.104
@@ -404,6 +404,7 @@
        void *data;
        int len;
        int nillen;
+       int ws;         /* if set we need to skip white space */
 } Column;
 
 @-
@@ -1003,6 +1004,23 @@
        }
 }
 
+#define myisspace(s)  (s == ' ' || s == '\t' || s == '\n')
+
+static int
+has_whitespace(char *sep)
+{
+       char *s = sep;
+
+       if (myisspace(*s)) 
+               return 1;
+       while(*s) 
+               s++;
+       s--;
+       if (myisspace(*s)) 
+               return 1;
+       return 0;
+}
+
 static size_t
 create_loadformat(Tablet * as, BAT *names, BAT *seps, BAT *types)
 {
@@ -1028,6 +1046,7 @@
                fmt[p].extra = fmt+p;
                fmt[p].len = fmt[p].nillen = 
                        ATOMlen(fmt[p].adt, ATOMnilptr(fmt[p].adt));
+               fmt[p].ws = !(has_whitespace(fmt[p].sep));
                fmt[p].data = GDKmalloc(fmt[p].len);
                if (tablet_debug)
                        stream_printf(GDKerr, "%s\n", fmt[p].name);
@@ -1064,6 +1083,7 @@
                fmt[p].data = NULL;
                fmt[p].len = 0;
                fmt[p].nillen = 0;
+               fmt[p].ws = 0;
                BBPunfix(b->batCacheid);
        }
        return as->nr_attrs;
@@ -1177,8 +1197,6 @@
        return bats;
 }
 
-#define myisspace(s)  (s == ' ' || s == '\t' || s == '\n')
-
 static INLINE char *
 lstrip(char *s)
 {
@@ -1292,7 +1310,7 @@
                s = line;
 
                /* skip leading spaces */
-               while (myisspace((int) (*line)))
+               while (fmt[i].ws && myisspace((int) (*line)))
                        line++;
 
                /* recognize fields starting with a quote */


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to