Switched to palloc_array and palloc0_array where possible

This commit is contained in:
Andrew Kane
2026-07-27 21:51:15 -07:00
parent bc4e6a13a2
commit 1be6148eca
9 changed files with 30 additions and 15 deletions

View File

@@ -26,6 +26,10 @@
#include "parser/scansup.h"
#endif
#if PG_VERSION_NUM < 160000
#define palloc_array(type, count) ((type *) palloc(sizeof(type) * (count)))
#endif
typedef struct SparseInputElement
{
int32 index;
@@ -223,7 +227,7 @@ sparsevec_in(PG_FUNCTION_ARGS)
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
errmsg("sparsevec cannot have more than %d non-zero elements", SPARSEVEC_MAX_NNZ)));
elements = palloc(maxNnz * sizeof(SparseInputElement));
elements = palloc_array(SparseInputElement, maxNnz);
pt = lit;