[srvx-commits] CVS: services/src saxdb.c,1.17,1.18 saxdb.h,1.4,1.5
Brought to you by:
entrope
|
From: Adrian D. <sai...@us...> - 2002-11-04 03:27:29
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv2646
Modified Files:
saxdb.c saxdb.h
Log Message:
Add saxdb context open/closing functions
Index: saxdb.c
===================================================================
RCS file: /cvsroot/srvx/services/src/saxdb.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** saxdb.c 28 Oct 2002 01:54:23 -0000 1.17
--- saxdb.c 4 Nov 2002 03:27:25 -0000 1.18
***************
*** 476,477 ****
--- 476,507 ----
return 0;
}
+
+ struct saxdb_context *
+ saxdb_open_context(FILE *file) {
+ struct saxdb_context *ctx;
+
+ assert(file);
+ ctx = calloc(1, sizeof(*ctx));
+ ctx->output = file;
+ int_list_init(&ctx->complex);
+
+ return ctx;
+ }
+
+ int
+ saxdb_setjmp(struct saxdb_context *ctx) {
+ if ((res = setjmp(ctx->jbuf))) {
+ if (res) {
+ log(MAIN_LOG, LOG_ERROR, "Exception %d caught while writing to %s\n", res, tmp_fname);
+ }
+ int_list_clean(&ctx->complex);
+ }
+ return res;
+ }
+
+ void
+ saxdb_close_context(struct saxdb_context *ctx) {
+ assert(ctx.complex.used == 0);
+ int_list_clean(&ctx.complex);
+ free(ctx);
+ }
Index: saxdb.h
===================================================================
RCS file: /cvsroot/srvx/services/src/saxdb.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** saxdb.h 27 Aug 2002 03:11:24 -0000 1.4
--- saxdb.h 4 Nov 2002 03:27:25 -0000 1.5
***************
*** 47,49 ****
--- 47,54 ----
void saxdb_write_int(struct saxdb_context *dest, const char *name, unsigned long value);
+ /* For doing db writing by hand */
+ struct saxdb_context *saxdb_open_context(FILE *f);
+ int saxdb_setjmp(struct saxdb_context *ctx);
+ void saxdb_close_context(struct saxdb_context *ctx);
+
#endif /* !defined(DBMGR_H) */
|