From c5fe519e57279645281e6fad7642c031f341dcfc Mon Sep 17 00:00:00 2001
From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Date: Thu, 27 Nov 2025 07:19:20 +0000
Subject: [PATCH v2 2/6] Removing unused function parameters in pgcrypto

A few parameters are not used, let's remove them.
---
 contrib/pgcrypto/pgcrypto.c  | 19 ++++++++-----------
 contrib/pgcrypto/pgp-pgsql.c |  4 ++--
 2 files changed, 10 insertions(+), 13 deletions(-)
 100.0% contrib/pgcrypto/

diff --git a/contrib/pgcrypto/pgcrypto.c b/contrib/pgcrypto/pgcrypto.c
index 9ecbbd2e2f8..5b762107e2e 100644
--- a/contrib/pgcrypto/pgcrypto.c
+++ b/contrib/pgcrypto/pgcrypto.c
@@ -56,8 +56,7 @@ static const struct config_enum_entry builtin_crypto_options[] = {
 };
 
 typedef int (*PFN) (const char *name, void **res);
-static void *find_provider(text *name, PFN provider_lookup, const char *desc,
-						   int silent);
+static void *find_provider(text *name, PFN provider_lookup, int silent);
 
 int			builtin_crypto_enabled = BC_ON;
 
@@ -98,7 +97,7 @@ pg_digest(PG_FUNCTION_ARGS)
 	name = PG_GETARG_TEXT_PP(1);
 
 	/* will give error if fails */
-	md = find_provider(name, (PFN) px_find_digest, "Digest", 0);
+	md = find_provider(name, (PFN) px_find_digest, 0);
 
 	hlen = px_md_result_size(md);
 
@@ -136,7 +135,7 @@ pg_hmac(PG_FUNCTION_ARGS)
 	name = PG_GETARG_TEXT_PP(2);
 
 	/* will give error if fails */
-	h = find_provider(name, (PFN) px_find_hmac, "HMAC", 0);
+	h = find_provider(name, (PFN) px_find_hmac, 0);
 
 	hlen = px_hmac_result_size(h);
 
@@ -262,7 +261,7 @@ pg_encrypt(PG_FUNCTION_ARGS)
 				rlen;
 
 	type = PG_GETARG_TEXT_PP(2);
-	c = find_provider(type, (PFN) px_find_combo, "Cipher", 0);
+	c = find_provider(type, (PFN) px_find_combo, 0);
 
 	data = PG_GETARG_BYTEA_PP(0);
 	key = PG_GETARG_BYTEA_PP(1);
@@ -311,7 +310,7 @@ pg_decrypt(PG_FUNCTION_ARGS)
 				rlen;
 
 	type = PG_GETARG_TEXT_PP(2);
-	c = find_provider(type, (PFN) px_find_combo, "Cipher", 0);
+	c = find_provider(type, (PFN) px_find_combo, 0);
 
 	data = PG_GETARG_BYTEA_PP(0);
 	key = PG_GETARG_BYTEA_PP(1);
@@ -361,7 +360,7 @@ pg_encrypt_iv(PG_FUNCTION_ARGS)
 				rlen;
 
 	type = PG_GETARG_TEXT_PP(3);
-	c = find_provider(type, (PFN) px_find_combo, "Cipher", 0);
+	c = find_provider(type, (PFN) px_find_combo, 0);
 
 	data = PG_GETARG_BYTEA_PP(0);
 	key = PG_GETARG_BYTEA_PP(1);
@@ -415,7 +414,7 @@ pg_decrypt_iv(PG_FUNCTION_ARGS)
 				ivlen;
 
 	type = PG_GETARG_TEXT_PP(3);
-	c = find_provider(type, (PFN) px_find_combo, "Cipher", 0);
+	c = find_provider(type, (PFN) px_find_combo, 0);
 
 	data = PG_GETARG_BYTEA_PP(0);
 	key = PG_GETARG_BYTEA_PP(1);
@@ -493,9 +492,7 @@ pg_check_fipsmode(PG_FUNCTION_ARGS)
 }
 
 static void *
-find_provider(text *name,
-			  PFN provider_lookup,
-			  const char *desc, int silent)
+find_provider(text *name, PFN provider_lookup, int silent)
 {
 	void	   *res;
 	char	   *buf;
diff --git a/contrib/pgcrypto/pgp-pgsql.c b/contrib/pgcrypto/pgp-pgsql.c
index 7c9f4c7b39b..583d4ae17d2 100644
--- a/contrib/pgcrypto/pgp-pgsql.c
+++ b/contrib/pgcrypto/pgp-pgsql.c
@@ -119,7 +119,7 @@ struct debug_expect
 };
 
 static void
-fill_expect(struct debug_expect *ex, int text_mode)
+fill_expect(struct debug_expect *ex)
 {
 	ex->debug = 0;
 	ex->expect = 0;
@@ -353,7 +353,7 @@ init_work(PGP_Context **ctx_p, int is_text,
 {
 	int			err = pgp_init(ctx_p);
 
-	fill_expect(ex, is_text);
+	fill_expect(ex);
 
 	if (err == 0 && args != NULL)
 		err = parse_args(*ctx_p, (uint8 *) VARDATA_ANY(args),
-- 
2.34.1

