From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Linas Vepstas Newsgroups: gmane.lisp.guile.user Subject: [PATCH 7/12] Guile-DBI: Don't cast away const Date: Fri, 19 Sep 2008 09:15:20 -0500 Message-ID: <20080919141520.GG13684@linas.org> References: <3ae3aa420809190645o2fe2b746id80f53c5cb123e5b@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="BzCohdixPhurzSK4" X-Trace: ger.gmane.org 1221834114 7817 80.91.229.12 (19 Sep 2008 14:21:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 19 Sep 2008 14:21:54 +0000 (UTC) Cc: Guile User Mailing List To: Maurizio Boriani Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Fri Sep 19 16:22:39 2008 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Kggmn-0007Bk-7T for guile-user@m.gmane.org; Fri, 19 Sep 2008 16:16:43 +0200 Original-Received: from localhost ([127.0.0.1]:39007 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kggll-0000H7-UN for guile-user@m.gmane.org; Fri, 19 Sep 2008 10:15:37 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kgglg-0000Ga-SE for guile-user@gnu.org; Fri, 19 Sep 2008 10:15:32 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kggle-0000G1-HV for guile-user@gnu.org; Fri, 19 Sep 2008 10:15:31 -0400 Original-Received: from [199.232.76.173] (port=57169 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kggle-0000Fx-BW for guile-user@gnu.org; Fri, 19 Sep 2008 10:15:30 -0400 Original-Received: from wf-out-1314.google.com ([209.85.200.173]:29132) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Kggld-0006Ds-N1 for guile-user@gnu.org; Fri, 19 Sep 2008 10:15:30 -0400 Original-Received: by wf-out-1314.google.com with SMTP id 28so613017wfc.24 for ; Fri, 19 Sep 2008 07:15:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:to:cc:subject:message-id :references:mime-version:content-type:content-disposition :in-reply-to:user-agent:from; bh=84i9kzYbyiYIKv2LMc5bdjqq5Le9ZAMKuAq6Y7hcq/Y=; b=UOPZuldWKwbwvUSxTBVUUQB5IVs25BIZuYc1I53W1afwgTz7u+NgazIv7HmJy77fkU B3ECwRZOPt0o8s4E61WT0B9E7pbMeNJ3VUgNeTUmkbcLfOqFlpYB4Rx444ynENU6TUGB GAfJFO0ht33jSAFtaNkIQrdpklZyCS/SkH6js= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:to:cc:subject:message-id:references:mime-version:content-type :content-disposition:in-reply-to:user-agent:from; b=foCtsaZrWvuViTe9gOGaCzAkaLXmL1tzCzND8Uht35HlQ/StctnYI8OAArtXlxoaRd 9cUCMNQ/sk5Pbe3jtom++7vGdauxAdBuyXkXqhLCsq8kqkAS6Fwta7YoMjQjK6ABmSoE CeiVNJyOa4QGdbAAlftev/OKozILz67fW3/7g= Original-Received: by 10.141.141.3 with SMTP id t3mr70545rvn.124.1221833728806; Fri, 19 Sep 2008 07:15:28 -0700 (PDT) Original-Received: from linas.org ( [67.100.217.179]) by mx.google.com with ESMTPS id 4sm1208724yxj.7.2008.09.19.07.15.24 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 19 Sep 2008 07:15:24 -0700 (PDT) Content-Disposition: inline In-Reply-To: <3ae3aa420809190645o2fe2b746id80f53c5cb123e5b@mail.gmail.com> User-Agent: Mutt/1.5.15+20070412 (2007-04-11) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:6790 Archived-At: --BzCohdixPhurzSK4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Avoid casting away const. Actually, avoid casting. Signed-off-by: Linas Vepstas --- include/guile-dbi/guile-dbi.h | 2 +- src/guile-dbi.c | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) Index: guile-dbi-2.0.0/include/guile-dbi/guile-dbi.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- guile-dbi-2.0.0.orig/include/guile-dbi/guile-dbi.h 2008-09-16 21:40:30.= 000000000 -0500 +++ guile-dbi-2.0.0/include/guile-dbi/guile-dbi.h 2008-09-16 21:40:43.00000= 0000 -0500 @@ -48,7 +48,7 @@ void init_dbi(void); =20 =0C /* dbd dynamic wrapper stuff */ -void __gdbi_dbd_wrap(gdbi_db_handle_t* dbh, char* function_name, +void __gdbi_dbd_wrap(gdbi_db_handle_t* dbh, const char* function_name, void** function_pointer); /* end dbd dynamic wrapper stuff */ #endif Index: guile-dbi-2.0.0/src/guile-dbi.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- guile-dbi-2.0.0.orig/src/guile-dbi.c 2008-09-16 21:40:30.000000000 -0500 +++ guile-dbi-2.0.0/src/guile-dbi.c 2008-09-16 21:42:31.000000000 -0500 @@ -80,7 +80,7 @@ SCM_DEFINE (make_g_db_handle, "dbi-open" SCM_RETURN_NEWSMOB (g_db_handle_tag, g_db_handle); } =20 - __gdbi_dbd_wrap(g_db_handle,(char*) __FUNCTION__,(void**) &connect); =20 + __gdbi_dbd_wrap(g_db_handle, __FUNCTION__,(void**) &connect); if (scm_equal_p (SCM_CAR(g_db_handle->status),scm_from_int(0)) =3D=3D SC= M_BOOL_F) { free(bcknd_str); @@ -166,7 +166,7 @@ SCM_DEFINE (close_g_db_handle, "dbi-clos return SCM_UNSPECIFIED; } =20 - __gdbi_dbd_wrap(g_db_handle,(char*) __FUNCTION__,(void**) &dbd_close); = =20 + __gdbi_dbd_wrap(g_db_handle, __FUNCTION__,(void**) &dbd_close); if (scm_equal_p (SCM_CAR(g_db_handle->status),scm_from_int(0)) =3D=3D SC= M_BOOL_F) { scm_remember_upto_here_1(db_handle); @@ -223,7 +223,7 @@ SCM_DEFINE (query_g_db_handle, "dbi-quer g_db_handle =3D (struct g_db_handle*)SCM_SMOB_DATA(db_handle); query_str =3D scm_to_locale_string(query); =20 - __gdbi_dbd_wrap(g_db_handle,(char*) __FUNCTION__,(void**) &dbi_query); = =20 + __gdbi_dbd_wrap(g_db_handle, __FUNCTION__,(void**) &dbi_query); if (scm_equal_p (SCM_CAR(g_db_handle->status),scm_from_int(0)) =3D=3D SC= M_BOOL_T) { (*dbi_query)(g_db_handle,query_str); @@ -249,7 +249,7 @@ SCM_DEFINE (getrow_g_db_handle, "dbi-get SCM_ASSERT (DBI_SMOB_P(db_handle), db_handle, SCM_ARG1, "getrow_g_db_han= dle"); =20 g_db_handle =3D (struct g_db_handle*)SCM_SMOB_DATA(db_handle); =20 - __gdbi_dbd_wrap(g_db_handle,(char*) __FUNCTION__,(void**) &dbi_getrow); = =20 + __gdbi_dbd_wrap(g_db_handle, __FUNCTION__,(void**) &dbi_getrow); if (scm_equal_p (SCM_CAR(g_db_handle->status),scm_from_int(0)) =3D=3D SC= M_BOOL_F) { scm_remember_upto_here_1(db_handle); @@ -317,7 +317,7 @@ init_dbi(void) =0C /* dbd handler */ void -__gdbi_dbd_wrap(gdbi_db_handle_t* dbh, char* function_name, +__gdbi_dbd_wrap(gdbi_db_handle_t* dbh, const char* function_name, void** function_pointer) { char *ret =3D NULL; @@ -337,13 +337,13 @@ __gdbi_dbd_wrap(gdbi_db_handle_t* dbh, c } =20 sprintf(func,"__%s_%s",bcknd,function_name); - *(void **) (function_pointer) =3D dlsym(dbh->handle,func); + *function_pointer =3D dlsym(dbh->handle,func); if((ret =3D dlerror()) !=3D NULL) { free(bcknd); free(func); if (dbh->in_free) return; /* do not SCM anything while in GC */ - dbh->status =3D (SCM) scm_cons(scm_from_int(1), + dbh->status =3D scm_cons(scm_from_int(1), scm_makfrom0str(ret)); return; } @@ -358,5 +358,4 @@ __gdbi_dbd_wrap(gdbi_db_handle_t* dbh, c /* todo: error msg to be translated */ dbh->status =3D scm_cons(scm_from_int(0), scm_makfrom0str("symbol loaded")); - return; } --BzCohdixPhurzSK4 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iQEVAwUBSNOz+ISDRXfAOJJBAQJsgwgA0XFkgAWi7RRXbLmgiDcJQZpbIR0frOz6 Uhej2FfmS7mkNdLtBhHINfNdeFlnE7DBzwB6N3is4CY4n8OxNBafgIAeILL4vQqA H5OfKvtKVg0mDXdUQTGsrHhURPelXd9NXfAGItxb/PRDMxv4FgPOWhvPn/K/SaHE 0ym9YpCaqfQYlqXpGJXAoB+LPz0ET2ZkmHzLJdf/w2L+6CdQ4UoX8NZwkgLOX8fP 91AqGkV6WIoDJNjy8Z0eIV7xO0wbufKQANme67D8YyS8g07tupLh+b+0WU/GpLAC CndQqgqX4VOrvI+kYokkizP2hf9OdKm+frorUbdw/WSFU1HJwm0muQ== =w8GH -----END PGP SIGNATURE----- --BzCohdixPhurzSK4--