xml loading speedup
James LewisMoss
jimdres@mindspring.com
28 Dec 2000 02:16:00 -0500
--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=gncxml-r.diff
Index: src/engine/io-gncxml-r.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/engine/io-gncxml-r.c,v
retrieving revision 1.14
diff -u -b -r1.14 io-gncxml-r.c
--- src/engine/io-gncxml-r.c 2000/12/27 23:54:46 1.14
+++ src/engine/io-gncxml-r.c 2000/12/28 06:55:51
@@ -388,11 +388,13 @@
if(!pdata->parsing_ok) return;
+#if 0
{
gchar *tmp = g_strndup(text, len);
/*fprintf(stderr, "Hit chars (%s)\n", tmp);*/
g_free(tmp);
}
+#endif
frame = (sixtp_stack_frame *) pdata->stack->data;
if(frame->parser->characters_handler) {
@@ -802,13 +804,14 @@
} GNCParseStatus;
static gboolean
-isspace_str(const gchar *str) {
+isspace_str(const gchar *str, int nomorethan) {
const gchar *cursor = str;
- while(*cursor) {
+ while(*cursor && (nomorethan != 0)) {
if(!isspace(*cursor)) {
return(FALSE);
}
cursor++;
+ nomorethan--;
}
return(TRUE);
}
@@ -820,11 +823,7 @@
gpointer *result,
const char *text,
int length) {
- gchar *copytxt = g_strndup(text, length);
- gboolean is_space = isspace_str(copytxt);
-
- g_free(copytxt);
- return(is_space);
+ return(isspace_str(text, length));
}
static gboolean
@@ -935,7 +934,7 @@
return(FALSE);
}
- if(!isspace_str(str + num_read)) return(FALSE);
+ if(!isspace_str(str + num_read, -1)) return(FALSE);
return(TRUE);
}
@@ -1851,7 +1850,7 @@
}
if((sign != '+') && (sign != '-')) return(FALSE);
- if(!isspace_str(strpos + num_read)) return(FALSE);
+ if(!isspace_str(strpos + num_read, -1)) return(FALSE);
parsed_time.tm_gmtoff = (h1 * 10 + h2) * 60 * 60;
parsed_time.tm_gmtoff += (m1 * 10 + m2) * 60;
--=-=-=
--
@James LewisMoss <dres@debian.org> | Blessed Be!
@ http://jimdres.home.mindspring.com | Linux is kewl!
@"Argue for your limitations and sure enough, they're yours." Bach
--=-=-=--