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.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
@@ -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
@@ -31,18 +31,18 @@ static 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)
@@ -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
@@ -88,7 +88,7 @@ sql_find_iface(const char *name)
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);
@@ -97,16 +97,16 @@ sql_connect_create (char *name)
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 */
@@ -134,7 +134,7 @@ gamma_cvt_iface(SCM inval, void *outval, const char *func_name)
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 "
@@ -185,7 +185,7 @@ SCM_DEFINE_PUBLIC (sql_open_connection, "sql-open-connection", 1, 0, 0,
185} 185}
186#undef FUNC_NAME 186#undef FUNC_NAME
187 187
188SCM_DEFINE_PUBLIC (sql_close_connection, "sql-close-connection", 1, 0, 0, 188SCM_DEFINE_PUBLIC(sql_close_connection, "sql-close-connection", 1, 0, 0,
189 (SCM conn), 189 (SCM conn),
190 "Close connection to a database.") 190 "Close connection to a database.")
191#define FUNC_NAME s_sql_close_connection 191#define FUNC_NAME s_sql_close_connection
@@ -198,7 +198,7 @@ SCM_DEFINE_PUBLIC (sql_close_connection, "sql-close-connection", 1, 0, 0,
198} 198}
199#undef FUNC_NAME 199#undef FUNC_NAME
200 200
201SCM_DEFINE_PUBLIC (sql_query, "sql-query", 2, 0, 0, 201SCM_DEFINE_PUBLIC(sql_query, "sql-query", 2, 0, 0,
202 (SCM conn, SCM query), 202 (SCM conn, SCM query),
203"Send the SQL query @var{query} to the server using connection @var{conn} \ 203"Send the SQL query @var{query} to the server using connection @var{conn} \
204and return the result.\n\ 204and return the result.\n\
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,24 +21,17 @@
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; 29 mysql_close(mysql);
36 mysql_close(mysql); 30 return 0;
37 return sizeof(MYSQL);
38} 31}
39 32
40static SCM 33static SCM
41s_mysql_connect (SCM parmlist, const char *func_name) 34s_mysql_connect(SCM parmlist, const char *func_name)
42{ 35{
43 char *hostname = NULL; 36 char *hostname = NULL;
44 int port = 0; 37 int port = 0;
@@ -225,7 +218,7 @@ s_mysql_close(struct sql_connect *conn)
225 218
226struct sql_iface mysql_iface = { 219struct sql_iface mysql_iface = {
227