aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/utils/fmgr/dfmgr.c14
-rw-r--r--src/backend/utils/hash/dynahash.c11
2 files changed, 17 insertions, 8 deletions
diff --git a/src/backend/utils/fmgr/dfmgr.c b/src/backend/utils/fmgr/dfmgr.c
index 9dff1f5e829..bd779fdaf7a 100644
--- a/src/backend/utils/fmgr/dfmgr.c
+++ b/src/backend/utils/fmgr/dfmgr.c
@@ -95,7 +95,7 @@ static const Pg_magic_struct magic_data = PG_MODULE_MAGIC_DATA;
* named funcname in it.
*
* If the function is not found, we raise an error if signalNotFound is true,
- * else return (PGFunction) NULL. Note that errors in loading the library
+ * else return NULL. Note that errors in loading the library
* will provoke ereport() regardless of signalNotFound.
*
* If filehandle is not NULL, then *filehandle will be set to a handle
@@ -103,13 +103,13 @@ static const Pg_magic_struct magic_data = PG_MODULE_MAGIC_DATA;
* lookup_external_function to lookup additional functions in the same file
* at less cost than repeating load_external_function.
*/
-PGFunction
+void *
load_external_function(const char *filename, const char *funcname,
bool signalNotFound, void **filehandle)
{
char *fullname;
void *lib_handle;
- PGFunction retval;
+ void *retval;
/* Expand the possibly-abbreviated filename to an exact path name */
fullname = expand_dynamic_library_name(filename);
@@ -122,7 +122,7 @@ load_external_function(const char *filename, const char *funcname,
*filehandle = lib_handle;
/* Look up the function within the library. */
- retval = (PGFunction) dlsym(lib_handle, funcname);
+ retval = dlsym(lib_handle, funcname);
if (retval == NULL && signalNotFound)
ereport(ERROR,
@@ -165,12 +165,12 @@ load_file(const char *filename, bool restricted)
/*
* Lookup a function whose library file is already loaded.
- * Return (PGFunction) NULL if not found.
+ * Return NULL if not found.
*/
-PGFunction
+void *
lookup_external_function(void *filehandle, const char *funcname)
{
- return (PGFunction) dlsym(filehandle, funcname);
+ return dlsym(filehandle, funcname);
}
diff --git a/src/backend/utils/hash/dynahash.c b/src/backend/utils/hash/dynahash.c
index 2688e277267..5948b01abc3 100644
--- a/src/backend/utils/hash/dynahash.c
+++ b/src/backend/utils/hash/dynahash.c
@@ -398,7 +398,16 @@ hash_create(const char *tabname, long nelem, HASHCTL *info, int flags)
if (flags & HASH_KEYCOPY)
hashp->keycopy = info->keycopy;
else if (hashp->hash == string_hash)
- hashp->keycopy = (HashCopyFunc) strlcpy;
+ {
+ /*
+ * The signature of keycopy is meant for memcpy(), which returns
+ * void*, but strlcpy() returns size_t. Since we never use the return
+ * value of keycopy, and size_t is pretty much always the same size as
+ * void *, this should be safe. The extra cast in the middle is to
+ * avoid warnings from -Wcast-function-type.
+ */
+ hashp->keycopy = (HashCopyFunc) (pg_funcptr_t) strlcpy;
+ }
else
hashp->keycopy = memcpy;