This confused me for a minute so took the opportunity to clean it up.
Since: 2594cf0e8c04406ffff19b1651c5a406d376657c
---
src/backend/commands/variable.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index 0c85679420..56f15d2e37 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -589,11 +589,12 @@ check_transaction_deferrable(bool *newval, void **extra, GucSource source)
bool
check_random_seed(double *newval, void **extra, GucSource source)
{
- *extra = malloc(sizeof(int));
- if (!*extra)
+ bool *doit = *extra = malloc(sizeof(bool));
+ if (doit == NULL)
return false;
+
/* Arm the assign only if source of value is an interactive SET */
- *((int *) *extra) = (source >= PGC_S_INTERACTIVE);
+ *doit = (source >= PGC_S_INTERACTIVE);
return true;
}
@@ -601,10 +602,11 @@ check_random_seed(double *newval, void **extra, GucSource source)
void
assign_random_seed(double newval, void *extra)
{
+ bool *doit = (bool *)extra;
/* We'll do this at most once for any setting of the GUC variable */
- if (*((int *) extra))
+ if (*doit)
DirectFunctionCall1(setseed, Float8GetDatum(newval));
- *((int *) extra) = 0;
+ *doit = false;
}
const char *
--
2.17.0