diff options
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/gamma-expat.c | 10 | ||||
-rw-r--r-- | src/gsql_conn.c | 30 | ||||
-rw-r--r-- | src/guile-sql.h | 2 | ||||
-rw-r--r-- | src/mysql.c | 19 | ||||
-rw-r--r-- | src/pgsql.c | 27 | ||||
-rw-r--r-- | src/syslog-port.c | 124 |
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. | |||
31 | AC_PROG_AWK | 31 | AC_PROG_AWK |
32 | AC_PROG_CC | 32 | AC_PROG_CC |
33 | AC_PROG_INSTALL | 33 | AC_PROG_INSTALL |
34 | AC_PROG_LN_S | 34 | AC_PROG_LN_S |
35 | AM_PROG_LIBTOOL | 35 | AM_PROG_LIBTOOL |
36 | 36 | ||
37 | GINT_INIT(gint,[1.8]) | 37 | GINT_INIT(gint,[2.2.0]) |
38 | 38 | ||
39 | AC_SUBST(INCLUDEPATH) | 39 | AC_SUBST(INCLUDEPATH) |
40 | AC_MSG_CHECKING(for additional includes) | 40 | AC_MSG_CHECKING(for additional includes) |
41 | AC_ARG_WITH([include-path], | 41 | AC_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 | ||
30 | static SCM | 30 | static SCM |
31 | gamma_xml_parser_create(XML_Parser parser) | 31 | 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 | } |
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 | ||
43 | static scm_sizet | 43 | static size_t |
44 | gamma_xml_parser_free(SCM smob) | 44 | gamma_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 | ||
86 | static void | 86 | static void |
87 | gamma_xml_parser_init() | 87 | gamma_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 | ||
98 | static struct gamma_expat_user_data * | 98 | static struct gamma_expat_user_data * |
99 | make_user_data () | 99 | make_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]; | |||
28 | SCM_GLOBAL_SYMBOL (gamma_sql_error, "sql-error"); | 28 | SCM_GLOBAL_SYMBOL (gamma_sql_error, "sql-error"); |
29 | 29 | ||
30 | static long sql_connect_tag = -1; | 30 | static long sql_connect_tag = -1; |
31 | 31 | ||
32 | /* SMOB functions: */ | 32 | /* SMOB functions: */ |
33 | static SCM | 33 | static SCM |
34 | sql_connect_mark (SCM connect_smob) | 34 | sql_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 | ||
40 | static scm_sizet | 41 | static size_t |
41 | sql_connect_free (SCM connect_smob) | 42 | sql_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 | ||
56 | static int | 56 | static int |
57 | sql_connect_print (SCM connect_smob, SCM port, scm_print_state * pstate) | 57 | sql_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 | ||
90 | SCM | 90 | SCM |
91 | sql_connect_create (char *name) | 91 | sql_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 | ||
106 | static int | 106 | static int |
107 | scm_is_sql_connect (SCM scm) | 107 | scm_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 | ||
114 | static void | 114 | static void |
115 | gamma_cvt_iface(SCM inval, void *outval, const char *func_name) | 115 | gamma_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 | ||
137 | SCM_DEFINE_PUBLIC (sql_open_connection, "sql-open-connection", 1, 0, 0, | 137 | SCM_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 " |