From c6cb42e4fba2457c72e17aab2fbe01f411edf6fa Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Mon, 2 Jan 2006 08:59:20 +0000 Subject: "Relax" prototype and rename DSO_global_lookup_func to DSO_global_lookup. --- crypto/dso/dso.h | 15 ++++++++++++--- crypto/dso/dso_dl.c | 6 +++--- crypto/dso/dso_dlfcn.c | 11 +++++------ crypto/dso/dso_lib.c | 10 +--------- crypto/dso/dso_win32.c | 4 ++-- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/crypto/dso/dso.h b/crypto/dso/dso.h index 10efa4ac8d..c1d0dfeebb 100644 --- a/crypto/dso/dso.h +++ b/crypto/dso/dso.h @@ -173,9 +173,8 @@ typedef struct dso_meth_st /* Return pathname of the module containing location */ int (*pathbyaddr)(void *addr,char *path,int sz); - /* Perform global symbol lookup, i.e. among *all* modules, - * see commentray in dso_lib.c for further details. */ - DSO_FUNC_TYPE (*globallookup)(const char *symname); + /* Perform global symbol lookup, i.e. among *all* modules */ + void *(*globallookup)(const char *symname); } DSO_METHOD; /**********************************************************************/ @@ -313,6 +312,16 @@ DSO_METHOD *DSO_METHOD_vms(void); */ int DSO_pathbyaddr(void *addr,char *path,int sz); +/* This function should be used with caution! It looks up symbols in + * *all* loaded modules and if module gets unloaded by somebody else + * attempt to dereference the pointer is doomed to have fatal + * consequences. Primary usage for this function is to probe *core* + * system functionality, e.g. check if getnameinfo(3) is available + * at run-time without bothering about OS-specific details such as + * libc.so.versioning or where does it actually reside: in libc + * itself or libsocket. */ +void *DSO_global_lookup(const char *name); + /* BEGIN ERROR CODES */ /* The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. diff --git a/crypto/dso/dso_dl.c b/crypto/dso/dso_dl.c index 7c123c8580..fc4236bd9a 100644 --- a/crypto/dso/dso_dl.c +++ b/crypto/dso/dso_dl.c @@ -86,7 +86,7 @@ static int dl_ctrl(DSO *dso, int cmd, long larg, void *parg); static char *dl_name_converter(DSO *dso, const char *filename); static char *dl_merger(DSO *dso, const char *filespec1, const char *filespec2); static int dl_pathbyaddr(void *addr,char *path,int sz); -static DSO_FUNC_TYPE dl_globallookup(const char *name); +static void *dl_globallookup(const char *name); static DSO_METHOD dso_meth_dl = { "OpenSSL 'dl' shared library method", @@ -383,9 +383,9 @@ static int dl_pathbyaddr(void *addr,char *path,int sz) return -1; } -static DSO_FUNC_TYPE dl_globallookup(const char *name) +static void *dl_globallookup(const char *name) { - DSO_FUNC_TYPE ret; + void *ret; shl_t h = NULL; return shl_findsym(&h,name,TYPE_UNDEFINED,&ret) ? NULL : ret; diff --git a/crypto/dso/dso_dlfcn.c b/crypto/dso/dso_dlfcn.c index a4ab38f850..d0552c4621 100644 --- a/crypto/dso/dso_dlfcn.c +++ b/crypto/dso/dso_dlfcn.c @@ -99,7 +99,7 @@ static char *dlfcn_name_converter(DSO *dso, const char *filename); static char *dlfcn_merger(DSO *dso, const char *filespec1, const char *filespec2); static int dlfcn_pathbyaddr(void *addr,char *path,int sz); -static DSO_FUNC_TYPE dlfcn_globallookup(const char *name); +static void *dlfcn_globallookup(const char *name); static DSO_METHOD dso_meth_dlfcn = { "OpenSSL 'dlfcn' shared library method", @@ -446,17 +446,16 @@ static int dlfcn_pathbyaddr(void *addr,char *path,int sz) return -1; } -static DSO_FUNC_TYPE dlfcn_globallookup(const char *name) +static void *dlfcn_globallookup(const char *name) { - union { void *p; DSO_FUNC_TYPE f; } ret = { NULL }; - void *handle = dlopen(NULL,RTLD_LAZY); + void *ret = NULL,*handle = dlopen(NULL,RTLD_LAZY); if (handle) { - ret.p = dlsym(handle,name); + ret = dlsym(handle,name); dlclose(handle); } - return ret.f; + return ret; } #endif /* DSO_DLFCN */ diff --git a/crypto/dso/dso_lib.c b/crypto/dso/dso_lib.c index f4d148c24a..c9d978b527 100644 --- a/crypto/dso/dso_lib.c +++ b/crypto/dso/dso_lib.c @@ -477,15 +477,7 @@ int DSO_pathbyaddr(void *addr,char *path,int sz) return (*meth->pathbyaddr)(addr,path,sz); } -/* This function should be used with caution! It looks up symbols in - * *all* loaded modules and if module gets unloaded by somebody else - * attempt to dereference the pointer is doomed to have fatal - * consequences. Primary usage for this function is to probe *core* - * system functionality, e.g. check if getnameinfo(3) is available - * at run-time without bothering about OS-specific details such as - * libc.so.versioning or where does it actually reside: in libc - * itself or libsocket. */ -DSO_FUNC_TYPE DSO_global_lookup_func(const char *name) +void *DSO_global_lookup(const char *name) { DSO_METHOD *meth = default_DSO_meth; if (meth == NULL) meth = DSO_METHOD_openssl(); diff --git a/crypto/dso/dso_win32.c b/crypto/dso/dso_win32.c index 94fe473377..a9c82726bd 100644 --- a/crypto/dso/dso_win32.c +++ b/crypto/dso/dso_win32.c @@ -129,7 +129,7 @@ static char *win32_name_converter(DSO *dso, const char *filename); static char *win32_merger(DSO *dso, const char *filespec1, const char *filespec2); static int win32_pathbyaddr(void *addr,char *path,int sz); -static DSO_FUNC_TYPE win32_globallookup(const char *name); +static void *win32_globallookup(const char *name); static const char *openssl_strnchr(const char *string, int c, size_t len); @@ -773,7 +773,7 @@ static int win32_pathbyaddr(void *addr,char *path,int sz) return 0; } -static DSO_FUNC_TYPE win32_globallookup(const char *name) +static void *win32_globallookup(const char *name) { HMODULE dll; HANDLE hModuleSnap = INVALID_HANDLE_VALUE; -- cgit v1.2.3