From 15c1abd97710d74672e55d53148a0606baa91d18 Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Wed, 21 Aug 2024 07:24:03 +0900 Subject: [PATCH] Remove _PG_fini() ab02d702ef08 has removed from the backend the code able to support the unloading of modules, because this has never worked. This removes the last references to _PG_fini(), that could be used as a callback for modules to manipulate the stack when unloading a library. The test module ldap_password_func had the idea to declare it, doing nothing. The function declaration in fmgr.h is gone. It was left around in 2022 to avoid breaking extension code, but at this stage there are also benefits in letting extension developers know that keeping the unloading code is pointless and this move leads to less maintenance. Reviewed-by: Tom Lane, Heikki Linnakangas Discussion: https://postgr.es/m/ZsQfi0AUJoMF6NSd@paquier.xyz --- src/include/fmgr.h | 11 +++++------ .../modules/ldap_password_func/ldap_password_func.c | 7 ------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/include/fmgr.h b/src/include/fmgr.h index ccb4070a251..1e3795de4a8 100644 --- a/src/include/fmgr.h +++ b/src/include/fmgr.h @@ -425,14 +425,13 @@ extern int no_such_variable /* - * Declare _PG_init/_PG_fini centrally. Historically each shared library had - * its own declaration; but now that we want to mark these PGDLLEXPORT, using - * central declarations avoids each extension having to add that. Any - * existing declarations in extensions will continue to work if fmgr.h is - * included before them, otherwise compilation for Windows will fail. + * Declare _PG_init centrally. Historically each shared library had its own + * declaration; but now that we want to mark these PGDLLEXPORT, using central + * declarations avoids each extension having to add that. Any existing + * declarations in extensions will continue to work if fmgr.h is included + * before them, otherwise compilation for Windows will fail. */ extern PGDLLEXPORT void _PG_init(void); -extern PGDLLEXPORT void _PG_fini(void); /*------------------------------------------------------------------------- diff --git a/src/test/modules/ldap_password_func/ldap_password_func.c b/src/test/modules/ldap_password_func/ldap_password_func.c index 99c18a8f1c8..24d9c637818 100644 --- a/src/test/modules/ldap_password_func/ldap_password_func.c +++ b/src/test/modules/ldap_password_func/ldap_password_func.c @@ -23,7 +23,6 @@ PG_MODULE_MAGIC; void _PG_init(void); -void _PG_fini(void); /* hook function */ static char *rot13_passphrase(char *password); @@ -37,12 +36,6 @@ _PG_init(void) ldap_password_hook = rot13_passphrase; } -void -_PG_fini(void) -{ - /* do nothing yet */ -} - static char * rot13_passphrase(char *pw) { -- 2.30.2