Update of /cvsroot/monetdb/MonetDB4/src/modules/plain
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv22261/src/modules/plain
Modified Files:
ascii_io.mx
Log Message:
make sure we only skip whitespace if seperators aren't whitespace
Index: ascii_io.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB4/src/modules/plain/ascii_io.mx,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- ascii_io.mx 15 Oct 2007 15:24:08 -0000 1.11
+++ ascii_io.mx 23 Oct 2007 21:52:21 -0000 1.12
@@ -266,6 +266,7 @@
void *data;
int len;
int nillen;
+ int ws; /* if set we need to skip white space */
} ascii_io;
typedef struct ascii_load_t {
@@ -417,6 +418,23 @@
return (*BATatoms[type].atomToStr) (buf, len, a);
}
+#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(ascii *as, BAT *names, BAT *seps, BAT *types)
{
@@ -442,6 +460,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 (ascii_io_debug)
stream_printf(GDKerr, "%s\n", fmt[p].name);
@@ -478,6 +497,7 @@
fmt[p].data = NULL;
fmt[p].len = 0;
fmt[p].nillen = 0;
+ fmt[p].ws = 0;
BBPunfix(b->batCacheid);
}
return as->nr_attrs;
@@ -594,8 +614,6 @@
return bats;
}
-#define myisspace(s) (s == ' ' || s == '\t' || s == '\n')
-
static INLINE char *
lstrip(char *s)
{
@@ -703,7 +721,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