Skip to content

Commit e6f5d1a

Browse files
committed
Drop const cast from dlsym() calls
This workaround might be obsolete. We'll see if those "older platforms" mentioned in the comment are still around. Discussion: https://www.postgresql.org/message-id/08adbe4e-38f8-2c73-55f0-591392371687%402ndquadrant.com
1 parent 807e4bc commit e6f5d1a

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/backend/utils/fmgr/dfmgr.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,8 @@ load_external_function(const char *filename, const char *funcname,
121121
if (filehandle)
122122
*filehandle = lib_handle;
123123

124-
/*
125-
* Look up the function within the library. According to POSIX dlsym()
126-
* should declare its second argument as "const char *", but older
127-
* platforms might not, so for the time being we just cast away const.
128-
*/
129-
retval = (PGFunction) dlsym(lib_handle, (char *) funcname);
124+
/* Look up the function within the library. */
125+
retval = (PGFunction) dlsym(lib_handle, funcname);
130126

131127
if (retval == NULL && signalNotFound)
132128
ereport(ERROR,
@@ -174,8 +170,7 @@ load_file(const char *filename, bool restricted)
174170
PGFunction
175171
lookup_external_function(void *filehandle, const char *funcname)
176172
{
177-
/* as above, cast away const for the time being */
178-
return (PGFunction) dlsym(filehandle, (char *) funcname);
173+
return (PGFunction) dlsym(filehandle, funcname);
179174
}
180175

181176

0 commit comments

Comments
 (0)