fix "dereferencing type-punned pointer will break strict-aliasing rules"

warning when using gcc 4.0
This commit is contained in:
Nils Larsch 2005-05-19 11:59:35 +00:00
parent 97d37c1c1e
commit f5634286a3

View File

@ -237,7 +237,7 @@ static void *dlfcn_bind_var(DSO *dso, const char *symname)
static DSO_FUNC_TYPE dlfcn_bind_func(DSO *dso, const char *symname) static DSO_FUNC_TYPE dlfcn_bind_func(DSO *dso, const char *symname)
{ {
void *ptr; void *ptr;
DSO_FUNC_TYPE sym; DSO_FUNC_TYPE sym, *tsym = &sym;
if((dso == NULL) || (symname == NULL)) if((dso == NULL) || (symname == NULL))
{ {
@ -255,7 +255,7 @@ static DSO_FUNC_TYPE dlfcn_bind_func(DSO *dso, const char *symname)
DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_NULL_HANDLE); DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_NULL_HANDLE);
return(NULL); return(NULL);
} }
*(void **)(&sym) = dlsym(ptr, symname); *(void **)(tsym) = dlsym(ptr, symname);
if(sym == NULL) if(sym == NULL)
{ {
DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_SYM_FAILURE); DSOerr(DSO_F_DLFCN_BIND_FUNC,DSO_R_SYM_FAILURE);