diff options
| author | Peter Eisentraut <peter@eisentraut.org> | 2025-12-09 06:58:39 +0100 |
|---|---|---|
| committer | Peter Eisentraut <peter@eisentraut.org> | 2025-12-09 07:33:08 +0100 |
| commit | 907caf5c392ad75177bdfd48d38cf0cc6904e8e1 (patch) | |
| tree | ad492d0b5caecff0e43fd6516722ad38abb82f88 /contrib | |
| parent | 2b117bb014d066549c319dcd73bd538e32b0c408 (diff) | |
Clean up int64-related format strings
Remove some gratuitous uses of INT64_FORMAT. Make use of
PRIu64/PRId64 were appropriate, remove unnecessary casts.
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/07fa29f9-42d7-4aac-8834-197918cbbab6%40eisentraut.org
Diffstat (limited to 'contrib')
| -rw-r--r-- | contrib/isn/isn.c | 26 | ||||
| -rw-r--r-- | contrib/isn/isn.h | 2 | ||||
| -rw-r--r-- | contrib/pageinspect/btreefuncs.c | 11 |
3 files changed, 9 insertions, 30 deletions
diff --git a/contrib/isn/isn.c b/contrib/isn/isn.c index 1880c91844e..3caa3af8b4c 100644 --- a/contrib/isn/isn.c +++ b/contrib/isn/isn.c @@ -423,19 +423,10 @@ eanwrongtype: eantoobig: if (!errorOK) - { - char eanbuf[64]; - - /* - * Format the number separately to keep the machine-dependent format - * code out of the translatable message text - */ - snprintf(eanbuf, sizeof(eanbuf), EAN13_FORMAT, ean); ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), - errmsg("value \"%s\" is out of range for %s type", - eanbuf, isn_names[type]))); - } + errmsg("value \"%" PRIu64 "\" is out of range for %s type", + ean, isn_names[type]))); return false; } @@ -660,19 +651,10 @@ okay: eantoobig: if (!errorOK) - { - char eanbuf[64]; - - /* - * Format the number separately to keep the machine-dependent format - * code out of the translatable message text - */ - snprintf(eanbuf, sizeof(eanbuf), EAN13_FORMAT, ean); ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), - errmsg("value \"%s\" is out of range for %s type", - eanbuf, isn_names[type]))); - } + errmsg("value \"%" PRIu64 "\" is out of range for %s type", + ean, isn_names[type]))); return false; } diff --git a/contrib/isn/isn.h b/contrib/isn/isn.h index 399896ad417..4551d7828fb 100644 --- a/contrib/isn/isn.h +++ b/contrib/isn/isn.h @@ -24,8 +24,6 @@ */ typedef uint64 ean13; -#define EAN13_FORMAT UINT64_FORMAT - #define PG_GETARG_EAN13(n) PG_GETARG_INT64(n) #define PG_RETURN_EAN13(x) PG_RETURN_INT64(x) diff --git a/contrib/pageinspect/btreefuncs.c b/contrib/pageinspect/btreefuncs.c index 7ff6dc08934..62c905c6e7c 100644 --- a/contrib/pageinspect/btreefuncs.c +++ b/contrib/pageinspect/btreefuncs.c @@ -901,10 +901,10 @@ bt_metap(PG_FUNCTION_ARGS) j = 0; values[j++] = psprintf("%d", metad->btm_magic); values[j++] = psprintf("%d", metad->btm_version); - values[j++] = psprintf(INT64_FORMAT, (int64) metad->btm_root); - values[j++] = psprintf(INT64_FORMAT, (int64) metad->btm_level); - values[j++] = psprintf(INT64_FORMAT, (int64) metad->btm_fastroot); - values[j++] = psprintf(INT64_FORMAT, (int64) metad->btm_fastlevel); + values[j++] = psprintf("%u", metad->btm_root); + values[j++] = psprintf("%u", metad->btm_level); + values[j++] = psprintf("%u", metad->btm_fastroot); + values[j++] = psprintf("%u", metad->btm_fastlevel); /* * Get values of extended metadata if available, use default values @@ -914,8 +914,7 @@ bt_metap(PG_FUNCTION_ARGS) */ if (metad->btm_version >= BTREE_NOVAC_VERSION) { - values[j++] = psprintf(INT64_FORMAT, - (int64) metad->btm_last_cleanup_num_delpages); + values[j++] = psprintf("%u", metad->btm_last_cleanup_num_delpages); values[j++] = psprintf("%f", metad->btm_last_cleanup_num_heap_tuples); values[j++] = metad->btm_allequalimage ? "t" : "f"; } |
