summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/arrayfuncs.c
diff options
context:
space:
mode:
authorPeter Eisentraut2025-12-09 05:58:39 +0000
committerPeter Eisentraut2025-12-09 06:33:08 +0000
commit2b117bb014d066549c319dcd73bd538e32b0c408 (patch)
tree3241b0bd942cdcb6bbaac7b83dcb06aabb042e81 /src/backend/utils/adt/arrayfuncs.c
parent0c3c5c3b06a37c13a811ea93044202e06523b705 (diff)
Remove unnecessary casts in printf format arguments (%zu/%zd)
Many of these are probably left over from before use of %zu/%zd was portable. 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 'src/backend/utils/adt/arrayfuncs.c')
-rw-r--r--src/backend/utils/adt/arrayfuncs.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/src/backend/utils/adt/arrayfuncs.c b/src/backend/utils/adt/arrayfuncs.c
index cc76bdde723..24e5b2adea1 100644
--- a/src/backend/utils/adt/arrayfuncs.c
+++ b/src/backend/utils/adt/arrayfuncs.c
@@ -333,8 +333,8 @@ array_in(PG_FUNCTION_ARGS)
if (!AllocSizeIsValid(nbytes))
ereturn(escontext, (Datum) 0,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxAllocSize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxAllocSize)));
}
}
if (hasnulls)
@@ -492,8 +492,8 @@ ReadArrayDimensions(char **srcptr, int *ndim_p, int *dim, int *lBound,
pg_add_s32_overflow(ub, 1, &ub))
ereturn(escontext, false,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxArraySize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxArraySize)));
dim[ndim] = ub;
ndim++;
@@ -725,8 +725,8 @@ ReadArrayStr(char **srcptr,
if (maxitems >= MaxArraySize)
ereturn(escontext, false,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxArraySize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxArraySize)));
maxitems = Min(maxitems * 2, MaxArraySize);
values = repalloc_array(values, Datum, maxitems);
nulls = repalloc_array(nulls, bool, maxitems);
@@ -1531,8 +1531,8 @@ ReadArrayBinary(StringInfo buf,
if (!AllocSizeIsValid(totbytes))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxAllocSize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxAllocSize)));
}
}
*hasnulls = hasnull;
@@ -2339,8 +2339,8 @@ array_set_element(Datum arraydatum,
pg_add_s32_overflow(dim[0], addedbefore, &dim[0]))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxArraySize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxArraySize)));
lb[0] = indx[0];
if (addedbefore > 1)
newhasnulls = true; /* will insert nulls */
@@ -2354,8 +2354,8 @@ array_set_element(Datum arraydatum,
pg_add_s32_overflow(dim[0], addedafter, &dim[0]))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxArraySize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxArraySize)));
if (addedafter > 1)
newhasnulls = true; /* will insert nulls */
}
@@ -2616,8 +2616,8 @@ array_set_element_expanded(Datum arraydatum,
pg_add_s32_overflow(dim[0], addedbefore, &dim[0]))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxArraySize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxArraySize)));
lb[0] = indx[0];
dimschanged = true;
if (addedbefore > 1)
@@ -2632,8 +2632,8 @@ array_set_element_expanded(Datum arraydatum,
pg_add_s32_overflow(dim[0], addedafter, &dim[0]))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxArraySize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxArraySize)));
dimschanged = true;
if (addedafter > 1)
newhasnulls = true; /* will insert nulls */
@@ -2893,8 +2893,8 @@ array_set_slice(Datum arraydatum,
pg_add_s32_overflow(dim[i], 1, &dim[i]))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxArraySize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxArraySize)));
lb[i] = lowerIndx[i];
}
@@ -2947,8 +2947,8 @@ array_set_slice(Datum arraydatum,
pg_add_s32_overflow(dim[0], addedbefore, &dim[0]))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxArraySize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxArraySize)));
lb[0] = lowerIndx[0];
if (addedbefore > 1)
newhasnulls = true; /* will insert nulls */
@@ -2962,8 +2962,8 @@ array_set_slice(Datum arraydatum,
pg_add_s32_overflow(dim[0], addedafter, &dim[0]))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxArraySize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxArraySize)));
if (addedafter > 1)
newhasnulls = true; /* will insert nulls */
}
@@ -3303,8 +3303,8 @@ array_map(Datum arrayd,
if (!AllocSizeIsValid(nbytes))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxAllocSize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxAllocSize)));
}
}
@@ -3543,8 +3543,8 @@ construct_md_array(Datum *elems,
if (!AllocSizeIsValid(nbytes))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxAllocSize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxAllocSize)));
}
/* Allocate and initialize result array */
@@ -5375,8 +5375,8 @@ accumArrayResult(ArrayBuildState *astate,
if (!AllocSizeIsValid(astate->alen * sizeof(Datum)))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxAllocSize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxAllocSize)));
astate->dvalues = (Datum *)
repalloc(astate->dvalues, astate->alen * sizeof(Datum));
astate->dnulls = (bool *)
@@ -6214,8 +6214,8 @@ array_fill_internal(ArrayType *dims, ArrayType *lbs,
!AllocSizeIsValid(totbytes))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxAllocSize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxAllocSize)));
/*
* This addition can't overflow, but it might cause us to go past
@@ -6558,8 +6558,8 @@ array_replace_internal(ArrayType *array,
if (!AllocSizeIsValid(nbytes))
ereport(ERROR,
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
- errmsg("array size exceeds the maximum allowed (%d)",
- (int) MaxAllocSize)));
+ errmsg("array size exceeds the maximum allowed (%zu)",
+ MaxAllocSize)));
}
nresult++;
}