aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2018-08-21 11:00:53 +0300
committerSergey Poznyakoff <gray@gnu.org>2018-08-21 11:00:53 +0300
commit6abb2548315b9db2925194e54f09f01126182f81 (patch)
tree327743c0e929933ae38a241770d08da0433561b4
parent3adba48f117f748dfb08a0dd4cdd42f214bae93f (diff)
downloadgamma-6abb2548315b9db2925194e54f09f01126182f81.tar.gz
gamma-6abb2548315b9db2925194e54f09f01126182f81.tar.bz2
Switch to Guile 2.2
Drop support for older Guile versions.
-rw-r--r--configure.ac2
-rw-r--r--src/gamma-expat.c10
-rw-r--r--src/gsql_conn.c8
-rw-r--r--src/guile-sql.h2
-rw-r--r--src/mysql.c15
-rw-r--r--src/pgsql.c19
-rw-r--r--src/syslog-port.c124
7 files changed, 43 insertions, 137 deletions
diff --git a/configure.ac b/configure.ac
index 15aeb87..0695551 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,7 +34,7 @@ AC_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)
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
@@ -32,7 +32,7 @@ gamma_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}
@@ -40,7 +40,7 @@ gamma_xml_parser_create(XML_Parser parser)
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);
@@ -84,7 +84,7 @@ gamma_xml_parser_print(SCM smob, SCM port, scm_print_state *pstate)
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",
@@ -96,7 +96,7 @@ gamma_xml_parser_init()
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
@@ -153,7 +153,7 @@ SCM_DEFINE_PUBLIC(scm_xml_primitive_make_parser, "xml-primitive-make-parser",
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);
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
@@ -34,15 +34,15 @@ static 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 if (sql_iftab[conn->iface].mark)
37 return sql_iftab[conn->iface].mark(conn); 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)
@@ -50,7 +50,7 @@ sql_connect_free (SCM connect_smob)
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
diff --git a/src/guile-sql.h b/src/guile-sql.h
index 926aa74..f656fd4 100644
--- a/src/guile-sql.h
+++ b/src/guile-sql.h
@@ -39,7 +39,7 @@ struct sql_result {
39struct sql_iface { 39struct sql_iface {
40 char *name; 40 char *name;
41 SCM (*mark) (struct sql_connect *); 41 SCM (*mark) (struct sql_connect *);
42 scm_sizet (*free) (struct sql_connect *); 42 size_t (*free) (struct sql_connect *);
43 SCM (*connect) (SCM parmlist, const char *func_name); 43 SCM (*connect) (SCM parmlist, const char *func_name);
44 void (*close) (struct sql_connect *); 44 void (*close) (struct sql_connect *);
45 SCM (*query) (struct sql_connect *, const char *query); 45 SCM (*query) (struct sql_connect *, const char *query);
diff --git a/src/mysql.c b/src/mysql.c
index 1310212..dcc1847 100644
--- a/src/mysql.c
+++ b/src/mysql.c
@@ -21,20 +21,13 @@
21#include <guile-sql.h> 21#include <guile-sql.h>
22#include <mysql/mysql.h> 22#include <mysql/mysql.h>
23 23
24static SCM 24static size_t
25s_mysql_mark(struct sql_connect *conn)
26{
27 return SCM_BOOL_F;
28}
29
30static scm_sizet
31s_mysql_free(struct sql_connect *conn) 25s_mysql_free(struct sql_connect *conn)
32{ 26{
33 MYSQL *mysql = (MYSQL*) conn->data; 27 MYSQL *mysql = (MYSQL*) conn->data;
34 if (!mysql) 28 if (mysql)
35 return 0;
36 mysql_close(mysql); 29 mysql_close(mysql);
37 return sizeof(MYSQL); 30 return 0;
38} 31}
39 32
40static SCM 33static SCM
@@ -225,7 +218,7 @@ s_mysql_close(struct sql_connect *conn)
225 218
226struct sql_iface mysql_iface = { 219struct sql_iface mysql_iface = {
227 "mysql", 220 "mysql",
228 s_mysql_mark, 221 NULL, /* mark */
229 s_mysql_free, 222 s_mysql_free,
230 s_mysql_connect, 223 s_mysql_connect,
231 s_mysql_close, 224 s_mysql_close,
diff --git a/src/pgsql.c b/src/pgsql.c
index c5cf51e..1421c40 100644
--- a/src/pgsql.c
+++ b/src/pgsql.c
@@ -21,20 +21,13 @@
21#include <guile-sql.h> 21#include <guile-sql.h>
22#include <libpq-fe.h> 22#include <libpq-fe.h>
23 23
24static SCM 24static size_t
25s_pgsql_mark(struct sql_connect *conn)
26{
27 return SCM_BOOL_F;
28}
29
30static scm_sizet
31s_pgsql_free(struct sql_connect *conn) 25s_pgsql_free(struct sql_connect *conn)
32{ 26{
33 PGconn *pgconn = (PGconn*) conn->data; 27 PGconn *pgconn = (PGconn*) conn->data;
34 if (!pgconn) 28 if (pgconn)
35 return 0;
36 PQfinish(pgconn); 29 PQfinish(pgconn);
37 return sizeof(pgconn); 30 return 0;
38} 31}
39 32
40static SCM 33static SCM
@@ -168,15 +161,15 @@ static void
168s_pgsql_close(struct sql_connect *conn) 161s_pgsql_close(struct sql_connect *conn)
169{ 162{
170 PGconn *pgconn = (PGconn*) conn->data; 163 PGconn *pgconn = (PGconn*) conn->data;
171 if (!pgconn) 164 if (pgconn) {
172 return;
173 PQfinish(pgconn); 165 PQfinish(pgconn);
174 conn->data = NULL; 166 conn->data = NULL;
175 } 167 }
168}
176 169
177struct sql_iface pgsql_iface = { 170struct sql_iface pgsql_iface = {
178 "pgsql", 171 "pgsql",
179 s_pgsql_mark, 172 NULL, /* mark */
180 s_pgsql_free, 173 s_pgsql_free,
181 s_pgsql_connect, 174 s_pgsql_connect,
182 s_pgsql_close, 175 s_pgsql_close,
diff --git a/src/syslog-port.c b/src/syslog-port.c
index 4b27ef9..4388c10 100644
--- a/src/syslog-port.c
+++ b/src/syslog-port.c
@@ -28,7 +28,7 @@ typedef off_t scm_t_off;
28#endif 28#endif
29 29
30#define GAMMA_SYSLOG_PORT_BUFSIZE 1024 30#define GAMMA_SYSLOG_PORT_BUFSIZE 1024
31static scm_t_bits scm_tc16_syslog_port; 31static scm_t_port_type *scm_syslog_port_type;
32struct _gamma_syslog_port { 32struct _gamma_syslog_port {
33 int prio; 33 int prio;
34}; 34};
@@ -37,118 +37,40 @@ static SCM
37_make_syslog_port(int prio) 37_make_syslog_port(int prio)
38{ 38{
39 struct _gamma_syslog_port *dp; 39 struct _gamma_syslog_port *dp;
40 SCM port;
41 scm_port *pt;
42 40
43 dp = scm_gc_malloc (sizeof (struct _gamma_syslog_port), "syslog-port");