diff options
author | David Rowley <drowley@postgresql.org> | 2025-10-03 23:04:37 +1300 |
---|---|---|
committer | David Rowley <drowley@postgresql.org> | 2025-10-03 23:04:37 +1300 |
commit | a69b55cd47274d897f4d92c466bfda461c9acfda (patch) | |
tree | 9e28bd1b43c404a7324a9cc7616dd59e1b663ac0 /src | |
parent | 54ab74865147c0051357d23af63314ff5e7332f4 (diff) |
Tidy-up unneeded NULL parameter checks from SQL function
This function is marked as strict, so we can safely remove the checks
checking for NULL input parameters.
Author: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/CAApHDvqiN0+mbooUOSCDALc=GoM8DmTbCdvwnCwak6Wb2O1ZJA@mail.gmail.com
Diffstat (limited to 'src')
-rw-r--r-- | src/test/modules/test_bitmapset/test_bitmapset.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/test/modules/test_bitmapset/test_bitmapset.c b/src/test/modules/test_bitmapset/test_bitmapset.c index acaa93d2f11..8bc9b1f48e9 100644 --- a/src/test/modules/test_bitmapset/test_bitmapset.c +++ b/src/test/modules/test_bitmapset/test_bitmapset.c @@ -587,7 +587,7 @@ test_bitmap_match(PG_FUNCTION_ARGS) * "min_value" is the minimal value used for the members, that will stand * up to a range of "max_range". "num_ops" defines the number of time each * operation is done. "seed" is a random seed used to calculate the member - * values. + * values. When "seed" is <= 0, a random seed will be chosen automatically. * * The return value is the number of times all operations have been executed. */ @@ -600,25 +600,20 @@ test_random_operations(PG_FUNCTION_ARGS) Bitmapset *result = NULL; pg_prng_state state; uint64 seed = GetCurrentTimestamp(); - int num_ops = 5000; - int total_ops = 0; - int max_range = 2000; - int min_value = 0; + int num_ops; + int max_range; + int min_value; int member; int *members; int num_members = 0; + int total_ops = 0; - if (!PG_ARGISNULL(0) && PG_GETARG_INT32(0) > 0) + if (PG_GETARG_INT32(0) > 0) seed = PG_GETARG_INT32(0); - if (!PG_ARGISNULL(1)) - num_ops = PG_GETARG_INT32(1); - - if (!PG_ARGISNULL(2)) - max_range = PG_GETARG_INT32(2); - - if (!PG_ARGISNULL(3)) - min_value = PG_GETARG_INT32(3); + num_ops = PG_GETARG_INT32(1); + max_range = PG_GETARG_INT32(2); + min_value = PG_GETARG_INT32(3); pg_prng_seed(&state, seed); members = palloc(sizeof(int) * num_ops); |