diff options
| author | Michael Paquier | 2025-12-17 22:33:40 +0000 |
|---|---|---|
| committer | Michael Paquier | 2025-12-17 22:33:40 +0000 |
| commit | 167cb26718e3eae4fef470900b4cd1d434f15649 (patch) | |
| tree | ae989345736cd7b35a0b522319a19d8c9fe0a1df /src/test/modules/test_custom_stats | |
| parent | ab8af1db43031544a5c01314bef9f0392bfde7f9 (diff) | |
4ba012a8ed9c defined the "header" (pointer to the stats data) of
from_serialized_data() as a const, even though it is fine (and
expected!) for the callback to modify the shared memory entry when
loading the stats at startup.
While on it, this commit updates the callback to_serialized_data() in
the test module test_custom_stats to make the data extracted from the
"header" parameter a const since it should never be modified: the stats
are written to disk and no modifications are expected in the shared
memory entry.
This clarifies the API contract of these new callbacks.
Reported-By: Peter Eisentraut <peter@eisentraut.org>
Author: Michael Paquier <michael@paquier.xyz>
Co-authored-by: Sami Imseih <samimseih@gmail.com>
Discussion: https://postgr.es/m/d87a93b0-19c7-4db6-b9c0-d6827e7b2da1@eisentraut.org
Diffstat (limited to 'src/test/modules/test_custom_stats')
| -rw-r--r-- | src/test/modules/test_custom_stats/test_custom_var_stats.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/test/modules/test_custom_stats/test_custom_var_stats.c b/src/test/modules/test_custom_stats/test_custom_var_stats.c index c71922dc4a8..294085d6866 100644 --- a/src/test/modules/test_custom_stats/test_custom_var_stats.c +++ b/src/test/modules/test_custom_stats/test_custom_var_stats.c @@ -92,7 +92,7 @@ static void test_custom_stats_var_to_serialized_data(const PgStat_HashKey *key, /* Deserialization callback: read auxiliary entry data */ static bool test_custom_stats_var_from_serialized_data(const PgStat_HashKey *key, - const PgStatShared_Common *header, + PgStatShared_Common *header, FILE *statfile); /* Finish callback: end of statistics file operations */ @@ -196,7 +196,7 @@ test_custom_stats_var_to_serialized_data(const PgStat_HashKey *key, { char *description; size_t len; - PgStatShared_CustomVarEntry *entry = (PgStatShared_CustomVarEntry *) header; + const PgStatShared_CustomVarEntry *entry = (const PgStatShared_CustomVarEntry *) header; bool found; uint32 magic_number = TEST_CUSTOM_VAR_MAGIC_NUMBER; @@ -276,7 +276,7 @@ test_custom_stats_var_to_serialized_data(const PgStat_HashKey *key, */ static bool test_custom_stats_var_from_serialized_data(const PgStat_HashKey *key, - const PgStatShared_Common *header, + PgStatShared_Common *header, FILE *statfile) { PgStatShared_CustomVarEntry *entry; |
