(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
errmsg("array must not contain nulls")));
- key = (ltree_gist *) palloc(len);
+ key = (ltree_gist *) palloc0(len);
SET_VARSIZE(key, len);
key->flag = 0;
PG_RETURN_POINTER(retval);
}
len = LTG_HDRSIZE;
- key = (ltree_gist *) palloc(len);
+ key = (ltree_gist *) palloc0(len);
SET_VARSIZE(key, len);
key->flag = LTG_ALLTRUE;
}
len = LTG_HDRSIZE + ((flag & LTG_ALLTRUE) ? 0 : ASIGLEN);
- result = (ltree_gist *) palloc(len);
+ result = (ltree_gist *) palloc0(len);
SET_VARSIZE(result, len);
result->flag = flag;
if (!LTG_ISALLTRUE(result))
/* form initial .. */
if (LTG_ISALLTRUE(GETENTRY(entryvec, seed_1)))
{
- datum_l = (ltree_gist *) palloc(LTG_HDRSIZE);
+ datum_l = (ltree_gist *) palloc0(LTG_HDRSIZE);
SET_VARSIZE(datum_l, LTG_HDRSIZE);
datum_l->flag = LTG_ALLTRUE;
}
else
{
- datum_l = (ltree_gist *) palloc(LTG_HDRSIZE + ASIGLEN);
+ datum_l = (ltree_gist *) palloc0(LTG_HDRSIZE + ASIGLEN);
SET_VARSIZE(datum_l, LTG_HDRSIZE + ASIGLEN);
datum_l->flag = 0;
memcpy((void *) LTG_SIGN(datum_l), (void *) LTG_SIGN(GETENTRY(entryvec, seed_1)), sizeof(ABITVEC));
}
if (LTG_ISALLTRUE(GETENTRY(entryvec, seed_2)))
{
- datum_r = (ltree_gist *) palloc(LTG_HDRSIZE);
+ datum_r = (ltree_gist *) palloc0(LTG_HDRSIZE);
SET_VARSIZE(datum_r, LTG_HDRSIZE);
datum_r->flag = LTG_ALLTRUE;
}
else
{
- datum_r = (ltree_gist *) palloc(LTG_HDRSIZE + ASIGLEN);
+ datum_r = (ltree_gist *) palloc0(LTG_HDRSIZE + ASIGLEN);
SET_VARSIZE(datum_r, LTG_HDRSIZE + ASIGLEN);
datum_r->flag = 0;
memcpy((void *) LTG_SIGN(datum_r), (void *) LTG_SIGN(GETENTRY(entryvec, seed_2)), sizeof(ABITVEC));
PG_RETURN_NULL();
}
- item = (ltree *) palloc(VARSIZE(found));
+ item = (ltree *) palloc0(VARSIZE(found));
memcpy(item, found, VARSIZE(found));
PG_FREE_IF_COPY(la, 0);
PG_RETURN_NULL();
}
- item = (ltree *) palloc(VARSIZE(found));
+ item = (ltree *) palloc0(VARSIZE(found));
memcpy(item, found, VARSIZE(found));
PG_FREE_IF_COPY(la, 0);
PG_RETURN_NULL();
}
- item = (ltree *) palloc(VARSIZE(found));
+ item = (ltree *) palloc0(VARSIZE(found));
memcpy(item, found, VARSIZE(found));
PG_FREE_IF_COPY(la, 0);
PG_RETURN_NULL();
}
- item = (ltree *) palloc(VARSIZE(found));
+ item = (ltree *) palloc0(VARSIZE(found));
memcpy(item, found, VARSIZE(found));
PG_FREE_IF_COPY(la, 0);
ltree *val = (ltree *) DatumGetPointer(PG_DETOAST_DATUM(entry->key));
int32 len = LTG_HDRSIZE + VARSIZE(val);
- key = (ltree_gist *) palloc(len);
+ key = (ltree_gist *) palloc0(len);
SET_VARSIZE(key, len);
key->flag = LTG_ONENODE;
memcpy((void *) LTG_NODE(key), (void *) val, VARSIZE(val));
isleqr = (left == right || ISEQ(left, right)) ? true : false;
*size = LTG_HDRSIZE + ((isalltrue) ? 0 : SIGLEN) + VARSIZE(left) + ((isleqr) ? 0 : VARSIZE(right));
- result = (ltree_gist *) palloc(*size);
+ result = (ltree_gist *) palloc0(*size);
SET_VARSIZE(result, *size);
result->flag = 0;
lu_l = LTG_GETLNODE(GETENTRY(entryvec, array[FirstOffsetNumber].index));
isleqr = (lu_l == lu_r || ISEQ(lu_l, lu_r)) ? true : false;
size = LTG_HDRSIZE + ((lisat) ? 0 : SIGLEN) + VARSIZE(lu_l) + ((isleqr) ? 0 : VARSIZE(lu_r));
- lu = (ltree_gist *) palloc(size);
+ lu = (ltree_gist *) palloc0(size);
SET_VARSIZE(lu, size);
lu->flag = 0;
if (lisat)
ru_l = LTG_GETLNODE(GETENTRY(entryvec, array[1 + ((maxoff - FirstOffsetNumber + 1) / 2)].index));
isleqr = (ru_l == ru_r || ISEQ(ru_l, ru_r)) ? true : false;
size = LTG_HDRSIZE + ((risat) ? 0 : SIGLEN) + VARSIZE(ru_l) + ((isleqr) ? 0 : VARSIZE(ru_r));
- ru = (ltree_gist *) palloc(size);
+ ru = (ltree_gist *) palloc0(size);
SET_VARSIZE(ru, size);
ru->flag = 0;
if (risat)
static ltree *
copy_ltree(ltree *src)
{
- ltree *dst = (ltree *) palloc(VARSIZE(src));
+ ltree *dst = (ltree *) palloc0(VARSIZE(src));
memcpy(dst, src, VARSIZE(src));
return dst;
ptr = LEVEL_NEXT(ptr);
}
- res = (ltree *) palloc(LTREE_HDRSIZE + (end - start));
+ res = (ltree *) palloc0(LTREE_HDRSIZE + (end - start));
SET_VARSIZE(res, LTREE_HDRSIZE + (end - start));
res->numlevel = endpos - startpos;
{
ltree *r;
- r = (ltree *) palloc(VARSIZE(a) + VARSIZE(b) - LTREE_HDRSIZE);
+ r = (ltree *) palloc0(VARSIZE(a) + VARSIZE(b) - LTREE_HDRSIZE);
SET_VARSIZE(r, VARSIZE(a) + VARSIZE(b) - LTREE_HDRSIZE);
r->numlevel = a->numlevel + b->numlevel;
l1 = LEVEL_NEXT(l1);
}
- res = (ltree *) palloc(reslen);
+ res = (ltree *) palloc0(reslen);
SET_VARSIZE(res, reslen);
res->numlevel = num;
errmsg("ltxtquery is too large")));
commonlen = COMPUTESIZE(state.num, state.sumlen);
- query = (ltxtquery *) palloc(commonlen);
+ query = (ltxtquery *) palloc0(commonlen);
SET_VARSIZE(query, commonlen);
query->size = state.num;
ptr = GETQUERY(query);