提交 51175595 编写于 作者: G Geoff Thorpe

Constification, and a silly mistake in the comments.

上级 eca57e92
...@@ -72,11 +72,11 @@ typedef struct dso_meth_st ...@@ -72,11 +72,11 @@ typedef struct dso_meth_st
{ {
const char *name; const char *name;
/* Loads a shared library */ /* Loads a shared library */
int (*dso_load)(DSO *dso, char *filename); int (*dso_load)(DSO *dso, const char *filename);
/* Unloads a shared library */ /* Unloads a shared library */
int (*dso_unload)(DSO *dso); int (*dso_unload)(DSO *dso);
/* Binds a function, variable, or whatever */ /* Binds a function, variable, or whatever */
int (*dso_bind)(DSO *dso, char *symname, void **symptr); int (*dso_bind)(DSO *dso, const char *symname, void **symptr);
/* I don't think this would actually be used in any circumstances. */ /* I don't think this would actually be used in any circumstances. */
#if 0 #if 0
...@@ -120,13 +120,13 @@ DSO_METHOD *DSO_get_method(DSO *dso); ...@@ -120,13 +120,13 @@ DSO_METHOD *DSO_get_method(DSO *dso);
DSO_METHOD *DSO_set_method(DSO *dso, DSO_METHOD *meth); DSO_METHOD *DSO_set_method(DSO *dso, DSO_METHOD *meth);
/* The all-singing all-dancing load function, you normally pass NULL /* The all-singing all-dancing load function, you normally pass NULL
* for the last two parameters. Use DSO_up and DSO_free for reference * for the first and third parameters. Use DSO_up and DSO_free for
* count handling. */ * reference count handling. */
DSO *DSO_load(DSO *dso, char *filename, DSO_METHOD *meth); DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth);
/* This function binds to a function, variable, whatever inside a /* This function binds to a function, variable, whatever inside a
* shared library. */ * shared library. */
void *DSO_bind(DSO *dso, char *symname); void *DSO_bind(DSO *dso, const char *symname);
/* This method is the default, but will beg, borrow, or steal whatever /* This method is the default, but will beg, borrow, or steal whatever
* method should be the default on any particular platform (including * method should be the default on any particular platform (including
......
...@@ -69,9 +69,9 @@ DSO_METHOD *DSO_METHOD_dl(void) ...@@ -69,9 +69,9 @@ DSO_METHOD *DSO_METHOD_dl(void)
#include <dl.h> #include <dl.h>
static int dl_load(DSO *dso, char *filename); static int dl_load(DSO *dso, const char *filename);
static int dl_unload(DSO *dso); static int dl_unload(DSO *dso);
static int dl_bind(DSO *dso, char *symname, void **symptr); static int dl_bind(DSO *dso, const char *symname, void **symptr);
#if 0 #if 0
static int dl_unbind(DSO *dso, char *symname, void *symptr); static int dl_unbind(DSO *dso, char *symname, void *symptr);
static int dl_init(DSO *dso); static int dl_init(DSO *dso);
...@@ -102,7 +102,7 @@ DSO_METHOD *DSO_METHOD_dl(void) ...@@ -102,7 +102,7 @@ DSO_METHOD *DSO_METHOD_dl(void)
* type so the cast is safe. * type so the cast is safe.
*/ */
static int dl_load(DSO *dso, char *filename) static int dl_load(DSO *dso, const char *filename)
{ {
shl_t ptr; shl_t ptr;
...@@ -148,7 +148,7 @@ static int dl_unload(DSO *dso) ...@@ -148,7 +148,7 @@ static int dl_unload(DSO *dso)
return(1); return(1);
} }
static int dl_bind(DSO *dso, char *symname, void **symptr) static int dl_bind(DSO *dso, const char *symname, void **symptr)
{ {
shl_t ptr; shl_t ptr;
void *sym; void *sym;
......
...@@ -71,9 +71,9 @@ DSO_METHOD *DSO_METHOD_dlfcn(void) ...@@ -71,9 +71,9 @@ DSO_METHOD *DSO_METHOD_dlfcn(void)
#include <dlfcn.h> #include <dlfcn.h>
#endif #endif
static int dlfcn_load(DSO *dso, char *filename); static int dlfcn_load(DSO *dso, const char *filename);
static int dlfcn_unload(DSO *dso); static int dlfcn_unload(DSO *dso);
static int dlfcn_bind(DSO *dso, char *symname, void **symptr); static int dlfcn_bind(DSO *dso, const char *symname, void **symptr);
#if 0 #if 0
static int dlfcn_unbind(DSO *dso, char *symname, void *symptr); static int dlfcn_unbind(DSO *dso, char *symname, void *symptr);
static int dlfcn_init(DSO *dso); static int dlfcn_init(DSO *dso);
...@@ -102,7 +102,7 @@ DSO_METHOD *DSO_METHOD_dlfcn(void) ...@@ -102,7 +102,7 @@ DSO_METHOD *DSO_METHOD_dlfcn(void)
* (i) the handle (void*) returned from dlopen(). * (i) the handle (void*) returned from dlopen().
*/ */
static int dlfcn_load(DSO *dso, char *filename) static int dlfcn_load(DSO *dso, const char *filename)
{ {
void *ptr; void *ptr;
...@@ -148,7 +148,7 @@ static int dlfcn_unload(DSO *dso) ...@@ -148,7 +148,7 @@ static int dlfcn_unload(DSO *dso)
return(1); return(1);
} }
static int dlfcn_bind(DSO *dso, char *symname, void **symptr) static int dlfcn_bind(DSO *dso, const char *symname, void **symptr)
{ {
void *ptr, *sym; void *ptr, *sym;
......
...@@ -187,7 +187,7 @@ int DSO_up(DSO *dso) ...@@ -187,7 +187,7 @@ int DSO_up(DSO *dso)
return(1); return(1);
} }
DSO *DSO_load(DSO *dso, char *filename, DSO_METHOD *meth) DSO *DSO_load(DSO *dso, const char *filename, DSO_METHOD *meth)
{ {
DSO *ret; DSO *ret;
int allocated = 0; int allocated = 0;
...@@ -227,7 +227,7 @@ DSO *DSO_load(DSO *dso, char *filename, DSO_METHOD *meth) ...@@ -227,7 +227,7 @@ DSO *DSO_load(DSO *dso, char *filename, DSO_METHOD *meth)
return(ret); return(ret);
} }
void *DSO_bind(DSO *dso, char *symname) void *DSO_bind(DSO *dso, const char *symname)
{ {
void *ret = NULL; void *ret = NULL;
......
...@@ -67,9 +67,9 @@ DSO_METHOD *DSO_METHOD_win32(void) ...@@ -67,9 +67,9 @@ DSO_METHOD *DSO_METHOD_win32(void)
} }
#else #else
static int win32_load(DSO *dso, char *filename); static int win32_load(DSO *dso, const char *filename);
static int win32_unload(DSO *dso); static int win32_unload(DSO *dso);
static int win32_bind(DSO *dso, char *symname, void **symptr); static int win32_bind(DSO *dso, const char *symname, void **symptr);
#if 0 #if 0
static int win32_unbind(DSO *dso, char *symname, void *symptr); static int win32_unbind(DSO *dso, char *symname, void *symptr);
static int win32_init(DSO *dso); static int win32_init(DSO *dso);
...@@ -99,7 +99,7 @@ DSO_METHOD *DSO_METHOD_win32(void) ...@@ -99,7 +99,7 @@ DSO_METHOD *DSO_METHOD_win32(void)
* LoadLibrary(), and copied. * LoadLibrary(), and copied.
*/ */
static int win32_load(DSO *dso, char *filename) static int win32_load(DSO *dso, const char *filename)
{ {
HINSTANCE h, *p; HINSTANCE h, *p;
...@@ -159,7 +159,7 @@ static int win32_unload(DSO *dso) ...@@ -159,7 +159,7 @@ static int win32_unload(DSO *dso)
return(1); return(1);
} }
static int win32_bind(DSO *dso, char *symname, void **symptr) static int win32_bind(DSO *dso, const char *symname, void **symptr)
{ {
HINSTANCE *ptr; HINSTANCE *ptr;
void *sym; void *sym;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册