aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Rosevear <jpr@helixcode.com>2000-09-21 00:38:16 +0800
committerJP Rosevear <jpr@src.gnome.org>2000-09-21 00:38:16 +0800
commite6c1d16b60384de66e05598967c11647e3a31ad0 (patch)
tree5c07e88e9777c1f48621dcf92b3868f135c19a3c
parent30392b4e49833a64ae612f3b55c6e220cbe24bd2 (diff)
downloadgsoc2013-evolution-e6c1d16b60384de66e05598967c11647e3a31ad0.tar
gsoc2013-evolution-e6c1d16b60384de66e05598967c11647e3a31ad0.tar.gz
gsoc2013-evolution-e6c1d16b60384de66e05598967c11647e3a31ad0.tar.bz2
gsoc2013-evolution-e6c1d16b60384de66e05598967c11647e3a31ad0.tar.lz
gsoc2013-evolution-e6c1d16b60384de66e05598967c11647e3a31ad0.tar.xz
gsoc2013-evolution-e6c1d16b60384de66e05598967c11647e3a31ad0.tar.zst
gsoc2013-evolution-e6c1d16b60384de66e05598967c11647e3a31ad0.zip
Use a local sax handler.
2000-09-20 JP Rosevear <jpr@helixcode.com> * pcs/cal-backend.c (cal_backend_get_log_entries): Use a local sax handler. * conduits/todo/todo-conduit.c (pre_sync): Use xmlSAXParseFile (map_sax_parse): Delete svn path=/trunk/; revision=5524
-rw-r--r--calendar/ChangeLog8
-rw-r--r--calendar/conduits/todo/todo-conduit.c35
-rw-r--r--calendar/pcs/cal-backend.c33
3 files changed, 15 insertions, 61 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 2374ce7a5b..0ed078db56 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,13 @@
2000-09-20 JP Rosevear <jpr@helixcode.com>
+ * pcs/cal-backend.c (cal_backend_get_log_entries): Use a local
+ sax handler.
+
+ * conduits/todo/todo-conduit.c (pre_sync): Use xmlSAXParseFile
+ (map_sax_parse): Delete
+
+2000-09-20 JP Rosevear <jpr@helixcode.com>
+
* pcs/cal-backend.c (cal_backend_log_sax_start_element): Properly
assign the CalObjChange type.
(cal_backend_log_sax_parse): Delete
diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c
index 6b9659f70f..f456b6e81d 100644
--- a/calendar/conduits/todo/todo-conduit.c
+++ b/calendar/conduits/todo/todo-conduit.c
@@ -186,36 +186,6 @@ map_sax_start_element (void *data, const xmlChar *name,
}
}
-static int
-map_sax_parse (xmlSAXHandler *handler, EToDoConduitContext *ctxt, const char *filename)
-{
- int ret = 0;
- xmlParserCtxtPtr xc;
-
- if (!g_file_exists (filename))
- return 0;
-
- xc = xmlCreateFileParserCtxt (filename);
- if (xc == NULL)
- return -1;
-
- xc->sax = handler;
- xc->userData = (void *)ctxt;
-
- xmlParseDocument (xc);
-
- if (xc->wellFormed)
- ret = 0;
- else
- ret = -1;
-
- if (handler != NULL)
- xc->sax = NULL;
- xmlFreeParserCtxt(xc);
-
- return ret;
-}
-
static void
map_write_foreach (gpointer key, gpointer value, gpointer data)
{
@@ -615,9 +585,8 @@ pre_sync (GnomePilotConduit *conduit,
handler.startElement = map_sax_start_element;
filename = map_name (ctxt);
- ret = map_sax_parse (&handler, ctxt, filename);
- if (ret < 0)
- return ret;
+ if (xmlSAXUserParseFile (&logSAXParser, ctxt, filename) < 0)
+ return -1;
g_free (filename);
diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c
index 106fab28f8..350c53a78d 100644
--- a/calendar/pcs/cal-backend.c
+++ b/calendar/pcs/cal-backend.c
@@ -637,36 +637,10 @@ cal_backend_log_sax_end_element (CalBackendParseState *state, const CHAR *name)
}
}
-static xmlSAXHandler logSAXParser = {
- 0, /* internalSubset */
- 0, /* isStandalone */
- 0, /* hasInternalSubset */
- 0, /* hasExternalSubset */
- 0, /* resolveEntity */
- 0, /* getEntity */
- 0, /* entityDecl */
- 0, /* notationDecl */
- 0, /* attributeDecl */
- 0, /* elementDecl */
- 0, /* unparsedEntityDecl */
- 0, /* setDocumentLocator */
- 0, /* startDocument */
- 0, /* endDocument */
- (startElementSAXFunc)cal_backend_log_sax_start_element, /* startElement */
- (endElementSAXFunc)cal_backend_log_sax_end_element, /* endElement */
- 0, /* reference */
- 0, /* characters */
- 0, /* ignorableWhitespace */
- 0, /* processingInstruction */
- 0, /* comment */
- 0, /* warning */
- 0, /* error */
- 0, /* fatalError */
-};
-
static GHashTable *
cal_backend_get_log_entries (CalBackend *backend, CalObjType type, time_t since)
{
+ xmlSAXHandler handler;
CalBackendParseState state;
GHashTable *hash;
char *filename;
@@ -678,7 +652,9 @@ cal_backend_get_log_entries (CalBackend *backend, CalObjType type, time_t since)
if (!cal_backend_log_sync (backend))
return NULL;
- filename = cal_backend_log_name (backend->uri);
+ memset (&handler, 0, sizeof (xmlSAXHandler));
+ handler.startElement = (startElementSAXFunc)cal_backend_log_sax_start_element;
+ handler.endElement = (endElementSAXFunc)cal_backend_log_sax_end_element;
hash = g_hash_table_new (g_str_hash, g_str_equal);
@@ -687,6 +663,7 @@ cal_backend_get_log_entries (CalBackend *backend, CalObjType type, time_t since)
state.in_valid_timestamp = FALSE;
state.hash = hash;
+ filename = cal_backend_log_name (backend->uri);
if (xmlSAXUserParseFile (&logSAXParser, &state, filename) < 0)
return NULL;