mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-28 23:02:43 +08:00
Switched to palloc_array and palloc0_array where possible
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user