Update of /cvsroot/monetdb/pathfinder/src/sqlhelpers/xmlshred
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv32221
Modified Files:
encoding.c main.c shred_helper.c
Log Message:
-- Speed-wise, the ``fast format'' logic is obsolete now.
Index: encoding.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/src/sqlhelpers/xmlshred/encoding.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- encoding.c 10 Jan 2008 14:34:34 -0000 1.18
+++ encoding.c 10 Jan 2008 16:05:14 -0000 1.19
@@ -295,7 +295,7 @@
fmts = 0;
- while (fmts < FMT_MAX && (sep = strsep (&fmt, "%"))) {
+ while (fmts < FMT_MAX && (sep = strsplit (&fmt, "%"))) {
fmt_seps[fmts] = sep;
if (fmt) {
lambda = fmt_lambdas[(int)(*fmt)];
Index: shred_helper.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/src/sqlhelpers/xmlshred/shred_helper.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- shred_helper.c 10 Jan 2008 14:34:34 -0000 1.13
+++ shred_helper.c 10 Jan 2008 16:05:14 -0000 1.14
@@ -37,6 +37,38 @@
#include "shred_helper.h"
#include "oops.h"
+/*
+ * Get next token from string *in; tokens are (possibly empty)
+ * strings separated by characters from del.
+ */
+char *
+strsplit(char **in, const char *del)
+{
+ char *s;
+ const char *spanp;
+ int c, sc;
+ char *tok;
+
+ if (!(s = *in))
+ return NULL;
+ for (tok = s;;) {
+ c = *s++;
+ spanp = del;
+ do {
+ if ((sc = *spanp++) == c) {
+ if (c == 0)
+ s = NULL;
+ else
+ s[-1] = 0;
+ *in = s;
+ return (tok);
+ }
+ } while (sc != 0);
+ }
+
+ return NULL;
+}
+
#ifndef HAVE_STRDUP
/**
* Alternative definition of strdup. It just duplicates a string
Index: main.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/src/sqlhelpers/xmlshred/main.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- main.c 10 Jan 2008 14:34:34 -0000 1.9
+++ main.c 10 Jan 2008 16:05:14 -0000 1.10
@@ -187,7 +187,7 @@
#define MAIN_EXIT(rtn) \
do { /* free the copied strings ... */ \
if (progname) free (progname); \
- if (new_format) free (status.format); \
+ free (status.format); \
if (status.infile) free (status.infile); \
if (status.outfile) free (status.outfile); \
/* ... and exit */ \
@@ -197,7 +197,6 @@
main (int argc, char **argv)
{
shred_state_t status;
- bool new_format = false; /* make sure we free only a new format string */
char *progname = NULL;
FILE *shout = NULL;
@@ -213,7 +212,6 @@
progname = strndup (argv[0], FILENAME_MAX);
status.format = strdup(SQL_FORMAT);
- status.fastformat = true;
status.infile = NULL;
status.outfile = NULL;
status.statistics = true;
@@ -245,9 +243,7 @@
status.names_separate = false;
break;
case 'F':
- new_format = true;
status.format = strdup (optarg);
- status.fastformat = !strcmp (status.format, SQL_FORMAT);
status.statistics = (strstr (status.format, "%g")) != NULL;
break;
case 'f':
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins