[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 7/12] Guile-DBI: Don't cast away const
From: |
Linas Vepstas |
Subject: |
[PATCH 7/12] Guile-DBI: Don't cast away const |
Date: |
Fri, 19 Sep 2008 09:15:20 -0500 |
User-agent: |
Mutt/1.5.15+20070412 (2007-04-11) |
Avoid casting away const. Actually, avoid casting.
Signed-off-by: Linas Vepstas <address@hidden>
---
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
===================================================================
--- 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.000000000 -0500
@@ -48,7 +48,7 @@ void init_dbi(void);
/* 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
===================================================================
--- 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);
}
- __gdbi_dbd_wrap(g_db_handle,(char*) __FUNCTION__,(void**) &connect);
+ __gdbi_dbd_wrap(g_db_handle, __FUNCTION__,(void**) &connect);
if (scm_equal_p (SCM_CAR(g_db_handle->status),scm_from_int(0)) == SCM_BOOL_F)
{
free(bcknd_str);
@@ -166,7 +166,7 @@ SCM_DEFINE (close_g_db_handle, "dbi-clos
return SCM_UNSPECIFIED;
}
- __gdbi_dbd_wrap(g_db_handle,(char*) __FUNCTION__,(void**) &dbd_close);
+ __gdbi_dbd_wrap(g_db_handle, __FUNCTION__,(void**) &dbd_close);
if (scm_equal_p (SCM_CAR(g_db_handle->status),scm_from_int(0)) == SCM_BOOL_F)
{
scm_remember_upto_here_1(db_handle);
@@ -223,7 +223,7 @@ SCM_DEFINE (query_g_db_handle, "dbi-quer
g_db_handle = (struct g_db_handle*)SCM_SMOB_DATA(db_handle);
query_str = scm_to_locale_string(query);
- __gdbi_dbd_wrap(g_db_handle,(char*) __FUNCTION__,(void**) &dbi_query);
+ __gdbi_dbd_wrap(g_db_handle, __FUNCTION__,(void**) &dbi_query);
if (scm_equal_p (SCM_CAR(g_db_handle->status),scm_from_int(0)) == SCM_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_handle");
g_db_handle = (struct g_db_handle*)SCM_SMOB_DATA(db_handle);
- __gdbi_dbd_wrap(g_db_handle,(char*) __FUNCTION__,(void**) &dbi_getrow);
+ __gdbi_dbd_wrap(g_db_handle, __FUNCTION__,(void**) &dbi_getrow);
if (scm_equal_p (SCM_CAR(g_db_handle->status),scm_from_int(0)) == SCM_BOOL_F)
{
scm_remember_upto_here_1(db_handle);
@@ -317,7 +317,7 @@ init_dbi(void)
/* 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 = NULL;
@@ -337,13 +337,13 @@ __gdbi_dbd_wrap(gdbi_db_handle_t* dbh, c
}
sprintf(func,"__%s_%s",bcknd,function_name);
- *(void **) (function_pointer) = dlsym(dbh->handle,func);
+ *function_pointer = dlsym(dbh->handle,func);
if((ret = dlerror()) != NULL)
{
free(bcknd);
free(func);
if (dbh->in_free) return; /* do not SCM anything while in GC */
- dbh->status = (SCM) scm_cons(scm_from_int(1),
+ dbh->status = 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 = scm_cons(scm_from_int(0),
scm_makfrom0str("symbol loaded"));
- return;
}
signature.asc
Description: Digital signature
- PATCH [0/12]: Guile-DBI and Guile-DBD-Postgres, Linas Vepstas, 2008/09/19
- [PATCH 1/12] Guile-DBI: Avoid multiple init, Linas Vepstas, 2008/09/19
- [PATCH 2/12] Guile-DBI: minor cleanup, Linas Vepstas, 2008/09/19
- [PATCH 3/12] Guile-DBI: Fix memory leak, Linas Vepstas, 2008/09/19
- [PATCH 4/12] Guile-DBII: replace deprecated gh_ functions, Linas Vepstas, 2008/09/19
- [PATCH 6/12] Guile-DBI: Fix crash, avoid recursive free, Linas Vepstas, 2008/09/19
- [PATCH 5/12] Guile-DBI: Use remember_upto_here, Linas Vepstas, 2008/09/19
- [PATCH 7/12] Guile-DBI: Don't cast away const,
Linas Vepstas <=
- [PATCH 8/12] Guile-DBD-postgres: Fix handling of float point columns, Linas Vepstas, 2008/09/19
- [PATCH 9/12] Guile-DBD-postgres: Avoid discouraged functions, Linas Vepstas, 2008/09/19
- [PATCH 10/12] Guile-DBD-postgres: Fix off-by-one when fetching rows, Linas Vepstas, 2008/09/19
- [PATCH 11/12] Guile-DBD-postgres: Avoid deprecated functions, Linas Vepstas, 2008/09/19
- [PATCH 12/12] Guile-DBD-postgres: Crash in GC, Linas Vepstas, 2008/09/19
- Re: PATCH [0/12]: Guile-DBI and Guile-DBD-Postgres, Neil Jerram, 2008/09/19