summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2006-10-08 21:27:18 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2006-10-08 21:27:18 (GMT)
commitec6c52fd36c3c838825fb791aab4dfaf8c4c93d3 (patch) (side-by-side diff)
treee643a7e56ca2e9d2cbed92c0ca6bb526b7d95b65
parent4987cf3134f116d1881602141ccc5ee7d572b8de (diff)
downloadgamma-ec6c52fd36c3c838825fb791aab4dfaf8c4c93d3.tar.gz
gamma-ec6c52fd36c3c838825fb791aab4dfaf8c4c93d3.tar.bz2
(num_iface): Static
(sql_register_iface): Avoid registering the same interface twice.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--src/gsql_conn.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gsql_conn.c b/src/gsql_conn.c
index 4a48de7..3a44c18 100644
--- a/src/gsql_conn.c
+++ b/src/gsql_conn.c
@@ -22,7 +22,7 @@
#include <guile-sql.h>
#include <app.h>
-int num_iface;
+static int num_iface;
struct sql_iface sql_iftab[MAX_IFACES];
SCM_GLOBAL_SYMBOL (gsql_error, "gsql-error");
@@ -205,6 +205,9 @@ SCM_DEFINE (sql_query, "sql-query", 2, 0, 0,
int
sql_register_iface(struct sql_iface *ifp)
{
+ int n = sql_find_iface(ifp->name);
+ if (n != -1)
+ return n;
if (num_iface >= MAX_IFACES)
scm_misc_error("sql_register_iface",
"Too many ifaces registered",

Return to:

Send suggestions and report system problems to the System administrator.