unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Mike Gran <spk121@yahoo.com>
To: Guile User Mailing List <guile-user@gnu.org>
Subject: Patch to Guile-DBI: SCM_ASSERT
Date: Mon, 10 Nov 2008 20:32:38 -0800 (PST)	[thread overview]
Message-ID: <406962.97326.qm@web37901.mail.mud.yahoo.com> (raw)
In-Reply-To: 3ae3aa420811101444p3488b456u9fcf243f0a5cb9be@mail.gmail.com

[-- Attachment #1: Type: text/plain, Size: 436 bytes --]





----- Original Message ----
> From: Linas Vepstas <linasvepstas@gmail.com>
> 
> I was finally able to update the gna.org website for guile-dbi
> with a new release.
> See http://home.gna.org/guile-dbi/guile-dbi.html


A patch.  SCM_ASSERT usually uses the scheme function name in the assertion error instead of the C function name.  Also, in make_g_db_handle, the assertion for the second parameter is incorrect.

Thanks,

Mike Gran

[-- Attachment #2: guile-dbi.c.patch --]
[-- Type: application/octet-stream, Size: 3401 bytes --]

--- guile-dbi.c.0	2008-11-10 20:15:45.781250000 -0800
+++ guile-dbi.c	2008-11-10 20:23:44.406250000 -0800
@@ -37,15 +37,15 @@
 SCM_DEFINE (make_g_db_handle, "dbi-open", 2, 0, 0,
 	    (SCM bcknd, SCM conn_string),
 	    "Build db_handle smob.")
-#define FUNC_NAME s_make_db_handle
+#define FUNC_NAME s_make_g_db_handle
 {
   struct g_db_handle *g_db_handle = NULL;
   char* sodbd                     = NULL;
   char* bcknd_str                 = NULL;
   void (*connect)(gdbi_db_handle_t*);
 
-  SCM_ASSERT (scm_is_string (bcknd), bcknd, SCM_ARG1, "make_g_db_handle");
-  SCM_ASSERT (scm_is_string (conn_string), bcknd, SCM_ARG2, "make_g_db_handle");
+  SCM_ASSERT (scm_is_string (bcknd), bcknd, SCM_ARG1, FUNC_NAME);
+  SCM_ASSERT (scm_is_string (conn_string), conn_string, SCM_ARG2, FUNC_NAME);
 
   g_db_handle = (struct g_db_handle*)scm_gc_malloc(sizeof (struct g_db_handle),
 						   "g_db_handle");
@@ -153,12 +153,12 @@
 SCM_DEFINE (close_g_db_handle, "dbi-close", 1, 0, 0,
 	    (SCM db_handle),
 	    "Close db connection.")
-#define FUNC_NAME s_close_db_handle
+#define FUNC_NAME s_close_g_db_handle
 {
   struct g_db_handle *g_db_handle = NULL;
   void (*dbd_close)(gdbi_db_handle_t*);
 
-  SCM_ASSERT (DBI_SMOB_P(db_handle), db_handle, SCM_ARG1, "close_g_db_handle");
+  SCM_ASSERT (DBI_SMOB_P(db_handle), db_handle, SCM_ARG1, FUNC_NAME);
   g_db_handle = (struct g_db_handle*)SCM_SMOB_DATA(db_handle);
 
   if (g_db_handle->closed == SCM_BOOL_T)
@@ -210,15 +210,15 @@
 SCM_DEFINE (query_g_db_handle, "dbi-query", 2, 0, 0,
 	    (SCM db_handle, SCM query),
 	    "Do a query and set status.")
-#define FUNC_NAME s_query_db_handle
+#define FUNC_NAME s_query_g_db_handle
 {
   struct g_db_handle *g_db_handle = NULL;
   char               *query_str   = NULL;
 
   void (*dbi_query)(gdbi_db_handle_t*,char*);
 
-  SCM_ASSERT (DBI_SMOB_P(db_handle), db_handle, SCM_ARG1, "query_g_db_handle");  
-  SCM_ASSERT (scm_is_string (query), query, SCM_ARG2, "query_g_db_handle");
+  SCM_ASSERT (DBI_SMOB_P(db_handle), db_handle, SCM_ARG1, FUNC_NAME);  
+  SCM_ASSERT (scm_is_string (query), query, SCM_ARG2, FUNC_NAME);
 
   g_db_handle = (struct g_db_handle*)SCM_SMOB_DATA(db_handle);
   query_str = scm_to_locale_string(query);
@@ -240,13 +240,13 @@
 SCM_DEFINE (getrow_g_db_handle, "dbi-get_row", 1, 0, 0,
 	    (SCM db_handle),
 	    "Do a query and return a row in form of pair list or false")
-#define FUNC_NAME s_getrow_db_handle
+#define FUNC_NAME s_getrow_g_db_handle
 {
   struct g_db_handle *g_db_handle = NULL;
   SCM retrow = SCM_EOL;
   SCM (*dbi_getrow)(gdbi_db_handle_t*);
 
-  SCM_ASSERT (DBI_SMOB_P(db_handle), db_handle, SCM_ARG1, "getrow_g_db_handle");  
+  SCM_ASSERT (DBI_SMOB_P(db_handle), db_handle, SCM_ARG1, FUNC_NAME);  
   g_db_handle = (struct g_db_handle*)SCM_SMOB_DATA(db_handle);
 
   __gdbi_dbd_wrap(g_db_handle, __FUNCTION__,(void**) &dbi_getrow);
@@ -268,11 +268,11 @@
 SCM_DEFINE (getstat_g_db_handle, "dbi-get_status", 1, 0, 0,
 	    (SCM db_handle),
 	    "Return status pair, code and msg, from dbi smob.")
-#define FUNC_NAME s_getstat_db_handle
+#define FUNC_NAME s_getstat_g_db_handle
 {
   struct g_db_handle *g_db_handle = NULL;
 
-  SCM_ASSERT (DBI_SMOB_P(db_handle), db_handle, SCM_ARG1, "getstat_g_db_handle");  
+  SCM_ASSERT (DBI_SMOB_P(db_handle), db_handle, SCM_ARG1, FUNC_NAME);  
 
   g_db_handle = (struct g_db_handle*)SCM_SMOB_DATA(db_handle);
 

  reply	other threads:[~2008-11-11  4:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-10 22:44 ANNOUNCE: Guile-DBI version 2.1.1 Linas Vepstas
2008-11-11  4:32 ` Mike Gran [this message]
2008-11-11 14:36   ` Patch to Guile-DBI: SCM_ASSERT Linas Vepstas
2008-11-11 16:31     ` Mike Gran
2008-11-11 16:45       ` Linas Vepstas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=406962.97326.qm@web37901.mail.mud.yahoo.com \
    --to=spk121@yahoo.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).