* Copy datum to *dest and return total space used (including align padding) * * Caller must have handled case of NULL element */
| 4714 | * Caller must have handled case of NULL element |
| 4715 | */ |
| 4716 | static int |
| 4717 | ArrayCastAndSet(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 |
no outgoing calls
no test coverage detected