MCPcopy Create free account
hub / github.com/apache/cloudberry / ArrayCastAndSet

Function ArrayCastAndSet

src/backend/utils/adt/arrayfuncs.c:4716–4742  ·  view source on GitHub ↗

* Copy datum to *dest and return total space used (including align padding) * * Caller must have handled case of NULL element */

Source from the content-addressed store, hash-verified

4714 * Caller must have handled case of NULL element
4715 */
4716static int
4717ArrayCastAndSet(Datum src,
4718 int typlen,
4719 bool typbyval,
4720 char typalign,
4721 char *dest)
4722{
4723 int inc;
4724
4725 if (typlen > 0)
4726 {
4727 if (typbyval)
4728 store_att_byval(dest, src, typlen);
4729 else
4730 memmove(dest, DatumGetPointer(src), typlen);
4731 inc = att_align_nominal(typlen, typalign);
4732 }
4733 else
4734 {
4735 Assert(!typbyval);
4736 inc = att_addlength_datum(0, typlen, src);
4737 memmove(dest, DatumGetPointer(src), inc);
4738 inc = att_align_nominal(inc, typalign);
4739 }
4740
4741 return inc;
4742}
4743
4744/*
4745 * Advance ptr over nitems array elements

Callers 3

CopyArrayElsFunction · 0.85
array_set_elementFunction · 0.85
array_fill_internalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected