+static void client_init_xdoc(struct client *cl)
+{
+ int i;
+
+ cl->xdoc = xmalloc(sizeof(*cl->xdoc) * XDOC_CACHE_SIZE);
+ for (i = 0; i < XDOC_CACHE_SIZE; i++)
+ cl->xdoc[i] = 0;
+}
+
+static void client_destroy_xdoc(struct client *cl)
+{
+ int i;
+
+ assert(cl->xdoc);
+ for (i = 0; i < XDOC_CACHE_SIZE; i++)
+ if (cl->xdoc[i])
+ xmlFreeDoc(cl->xdoc[i]);
+ xfree(cl->xdoc);
+}
+
+xmlDoc *client_get_xdoc(struct client *cl, int record_no)
+{
+ assert(cl->xdoc);
+ if (record_no >= 0 && record_no < XDOC_CACHE_SIZE)
+ return cl->xdoc[record_no];
+ return 0;
+}
+
+void client_store_xdoc(struct client *cl, int record_no, xmlDoc *xdoc)
+{
+ assert(cl->xdoc);
+ if (record_no >= 0 && record_no < XDOC_CACHE_SIZE)
+ {
+ if (cl->xdoc[record_no])
+ xmlFreeDoc(cl->xdoc[record_no]);
+ cl->xdoc[record_no] = xdoc;
+ }
+ else
+ {
+ xmlFreeDoc(xdoc);
+ }
+}
+
+