aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--src/gamma-expat.c10
-rw-r--r--src/gsql_conn.c30
-rw-r--r--src/guile-sql.h2
-rw-r--r--src/mysql.c19
-rw-r--r--src/pgsql.c27
-rw-r--r--src/syslog-port.c124
7 files changed, 60 insertions, 154 deletions
diff --git a/configure.ac b/configure.ac
index 15aeb87..0695551 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,13 +31,13 @@ dnl Checks for programs.
31AC_PROG_AWK 31AC_PROG_AWK
32AC_PROG_CC 32AC_PROG_CC
33AC_PROG_INSTALL 33AC_PROG_INSTALL
34AC_PROG_LN_S 34AC_PROG_LN_S
35AM_PROG_LIBTOOL 35AM_PROG_LIBTOOL
36 36
37GINT_INIT(gint,[1.8]) 37GINT_INIT(gint,[2.2.0])
38 38
39AC_SUBST(INCLUDEPATH) 39AC_SUBST(INCLUDEPATH)
40AC_MSG_CHECKING(for additional includes) 40AC_MSG_CHECKING(for additional includes)
41AC_ARG_WITH([include-path], 41AC_ARG_WITH([include-path],
42 AC_HELP_STRING([--with-include-path=PATH], 42 AC_HELP_STRING([--with-include-path=PATH],
43 [specify additional include paths; PATH is a ':' separated list of directories]), 43 [specify additional include paths; PATH is a ':' separated list of directories]),
diff --git a/src/gamma-expat.c b/src/gamma-expat.c
index a81d30e..cd3efaa 100644
--- a/src/gamma-expat.c
+++ b/src/gamma-expat.c
@@ -29,21 +29,21 @@ struct gamma_xml_parser
29 29
30static SCM 30static SCM
31gamma_xml_parser_create(XML_Parser parser) 31gamma_xml_parser_create(XML_Parser parser)
32{ 32{
33 struct gamma_xml_parser *gp; 33 struct gamma_xml_parser *gp;
34 34
35 gp = scm_malloc(sizeof (*gp)); 35 gp = scm_gc_malloc(sizeof (*gp), "xml_parser");
36 gp->parser = parser; 36 gp->parser = parser;
37 SCM_RETURN_NEWSMOB(gamma_xml_parser_tag, gp); 37 SCM_RETURN_NEWSMOB(gamma_xml_parser_tag, gp);
38} 38}
39 39
40#define GAMMA_XML_PARSER_PTR(smob) \ 40#define GAMMA_XML_PARSER_PTR(smob) \
41 ((struct gamma_xml_parser *)SCM_CDR(smob)) 41 ((struct gamma_xml_parser *)SCM_CDR(smob))
42 42
43static scm_sizet 43static size_t
44gamma_xml_parser_free(SCM smob) 44gamma_xml_parser_free(SCM smob)
45{ 45{
46 struct gamma_xml_parser *gp = GAMMA_XML_PARSER_PTR(smob); 46 struct gamma_xml_parser *gp = GAMMA_XML_PARSER_PTR(smob);
47 if (gp->parser) { 47 if (gp->parser) {
48 struct gamma_expat_user_data *udata = 48 struct gamma_expat_user_data *udata =
49 XML_GetUserData(gp->parser); 49 XML_GetUserData(gp->parser);
@@ -81,25 +81,25 @@ gamma_xml_parser_print(SCM smob, SCM port, scm_print_state *pstate)
81 scm_puts("#<XML_Parser>", port); 81 scm_puts("#<XML_Parser>", port);
82 /* FIXME: show more details */ 82 /* FIXME: show more details */
83 return 1; 83 return 1;
84} 84}
85 85
86static void 86static void
87gamma_xml_parser_init() 87gamma_xml_parser_init(void)
88{ 88{
89 gamma_xml_parser_tag = 89 gamma_xml_parser_tag =
90 scm_make_smob_type("XML_Parser", 90 scm_make_smob_type("XML_Parser",
91 sizeof(struct gamma_xml_parser)); 91 sizeof(struct gamma_xml_parser));
92 scm_set_smob_mark(gamma_xml_parser_tag, gamma_xml_parser_mark); 92 scm_set_smob_mark(gamma_xml_parser_tag, gamma_xml_parser_mark);
93 scm_set_smob_free(gamma_xml_parser_tag, gamma_xml_parser_free); 93 scm_set_smob_free(gamma_xml_parser_tag, gamma_xml_parser_free);
94 scm_set_smob_print(gamma_xml_parser_tag, gamma_xml_parser_print); 94 scm_set_smob_print(gamma_xml_parser_tag, gamma_xml_parser_print);
95} 95}
96 96
97 97
98static struct gamma_expat_user_data * 98static struct gamma_expat_user_data *
99make_user_data () 99make_user_data(void)
100{ 100{
101 int i; 101 int i;
102 102
103 struct gamma_expat_user_data *p = scm_malloc(sizeof (*p)); 103 struct gamma_expat_user_data *p = scm_malloc(sizeof (*p));
104 for (i = 0; i < gamma_expat_handler_count; i++) 104 for (i = 0; i < gamma_expat_handler_count; i++)
105 p->handler[i] = SCM_UNSPECIFIED; 105 p->handler[i] = SCM_UNSPECIFIED;
@@ -150,13 +150,13 @@ SCM_DEFINE_PUBLIC(scm_xml_primitive_make_parser, "xml-primitive-make-parser",
150 SCM_VALIDATE_CHAR(2, sep); 150 SCM_VALIDATE_CHAR(2, sep);
151 separator = SCM_CHAR(sep); 151 separator = SCM_CHAR(sep);
152 parser = XML_ParserCreateNS(encoding, separator); 152 parser = XML_ParserCreateNS(encoding, separator);
153 } else 153 } else
154 parser = XML_ParserCreate(encoding); 154 parser = XML_ParserCreate(encoding);
155 if (!parser) 155 if (!parser)
156 scm_memory_error(FUNC_NAME); 156 scm_report_out_of_memory();
157 XML_SetUserData(parser, make_user_data()); 157 XML_SetUserData(parser, make_user_data());
158 free(encoding); 158 free(encoding);
159 return gamma_xml_parser_create(parser); 159 return gamma_xml_parser_create(parser);
160} 160}
161#undef FUNC_NAME 161#undef FUNC_NAME
162 162
diff --git a/src/gsql_conn.c b/src/gsql_conn.c
index 4d53a03..64cec27 100644
--- a/src/gsql_conn.c
+++ b/src/gsql_conn.c
@@ -28,32 +28,32 @@ static struct sql_iface sql_iftab[MAX_IFACES];
28SCM_GLOBAL_SYMBOL (gamma_sql_error, "sql-error"); 28SCM_GLOBAL_SYMBOL (gamma_sql_error, "sql-error");
29 29
30static long sql_connect_tag = -1; 30static long sql_connect_tag = -1;
31 31
32/* SMOB functions: */ 32/* SMOB functions: */
33static SCM 33static SCM
34sql_connect_mark (SCM connect_smob) 34sql_connect_mark(SCM connect_smob)
35{ 35{
36 struct sql_connect *conn = (struct sql_connect *)SCM_CDR(connect_smob); 36 struct sql_connect *conn = (struct sql_connect *)SCM_CDR(connect_smob);
37 return sql_iftab[conn->iface].mark(conn); 37 if (sql_iftab[conn->iface].mark)
38 return sql_iftab[conn->iface].mark(conn);
38} 39}
39 40
40static scm_sizet 41static size_t
41sql_connect_free (SCM connect_smob) 42sql_connect_free(SCM connect_smob)
42{ 43{
43 scm_sizet size = sizeof(struct sql_connect);
44 struct sql_connect *conn = (struct sql_connect *)SCM_CDR(connect_smob); 44 struct sql_connect *conn = (struct sql_connect *)SCM_CDR(connect_smob);
45 size += sql_iftab[conn->iface].free(conn); 45 sql_iftab[conn->iface].free(conn);
46 if (conn->hostname) 46 if (conn->hostname)
47 free(conn->hostname); 47 free(conn->hostname);
48 if (conn->username) 48 if (conn->username)
49 free(conn->username); 49 free(conn->username);
50 if (conn->database) 50 if (conn->database)
51 free(conn->database); 51 free(conn->database);
52 scm_gc_free(conn, sizeof *conn, "SQL connection"); 52 scm_gc_free(conn, sizeof *conn, "SQL connection");
53 return size; 53 return 0;
54} 54}
55 55
56static int 56static int
57sql_connect_print (SCM connect_smob, SCM port, scm_print_state * pstate) 57sql_connect_print (SCM connect_smob, SCM port, scm_print_state * pstate)
58{ 58{
59 struct sql_connect *conn = (struct sql_connect *)SCM_CDR(connect_smob); 59 struct sql_connect *conn = (struct sql_connect *)SCM_CDR(connect_smob);
@@ -85,31 +85,31 @@ sql_find_iface(const char *name)
85 if (strcmp(sql_iftab[iface].name, name) == 0) 85 if (strcmp(sql_iftab[iface].name, name) == 0)
86 return iface; 86 return iface;
87 return -1; 87 return -1;
88} 88}
89 89
90SCM 90SCM
91sql_connect_create (char *name) 91sql_connect_create(char *name)
92{ 92{
93 struct sql_connect *conn; 93 struct sql_connect *conn;
94 int iface = sql_find_iface(name); 94 int iface = sql_find_iface(name);
95 if (iface < 0) 95 if (iface < 0)
96 scm_misc_error("sql_connect_create", 96 scm_misc_error("sql_connect_create",
97 "Unknown SQL interface ~S", 97 "Unknown SQL interface ~S",
98 scm_list_1(scm_from_locale_string(name))); 98 scm_list_1(scm_from_locale_string(name)));
99 99
100 conn = scm_gc_malloc (sizeof (*conn), "sql_connect"); 100 conn = scm_gc_malloc(sizeof (*conn), "sql_connect");
101 memset(conn, 0, sizeof *conn); 101 memset(conn, 0, sizeof *conn);
102 conn->iface = iface; 102 conn->iface = iface;
103 SCM_RETURN_NEWSMOB (sql_connect_tag, conn); 103 SCM_RETURN_NEWSMOB(sql_connect_tag, conn);
104} 104}
105 105
106static int 106static int
107scm_is_sql_connect (SCM scm) 107scm_is_sql_connect(SCM scm)
108{ 108{
109 return SCM_NIMP (scm) && SCM_CAR (scm) == (SCM) sql_connect_tag; 109 return SCM_NIMP(scm) && SCM_CAR (scm) == (SCM) sql_connect_tag;
110} 110}
111 111
112/* Interface */ 112/* Interface */
113 113
114static void 114static void
115gamma_cvt_iface(SCM inval, void *outval, const char *func_name) 115gamma_cvt_iface(SCM inval, void *outval, const char *func_name)
@@ -131,13 +131,13 @@ gamma_cvt_iface(SCM inval, void *outval, const char *func_name)
131 scm_list_2(scm_from_int(1), 131 scm_list_2(scm_from_int(1),
132 inval)); 132 inval));
133 *(int*)outval = iface; 133 *(int*)outval = iface;
134} 134}
135 135
136 136
137SCM_DEFINE_PUBLIC (sql_open_connection, "sql-open-connection", 1, 0, 0, 137SCM_DEFINE_PUBLIC(sql_open_connection, "sql-open-connection", 1, 0, 0,
138 (SCM param), 138 (SCM param),
139"Connect to a database. Take connection parameters from @var{param}, " 139"Connect to a database. Take connection parameters from @var{param}, "
140"which must be a list of conses. In each cons, the @samp{car} contains " 140"which must be a list of conses. In each cons, the @samp{car} contains "
141"a @dfn{key} identifying the parameter, and the @samp{cdr} supplies the "