| 25 | void Tuple::dummy(Tuple::CodegenTypes*) {} |
| 26 | |
| 27 | bool Tuple::CopyStrings(const char* err_ctx, RuntimeState* state, |
| 28 | const SlotOffsets* string_slot_offsets, int num_string_slots, MemPool* pool, |
| 29 | Status* status) noexcept { |
| 30 | int64_t total_len = 0; |
| 31 | for (int i = 0; i < num_string_slots; ++i) { |
| 32 | if (IsNull(string_slot_offsets[i].null_indicator_offset)) continue; |
| 33 | StringValue* sv = GetStringSlot(string_slot_offsets[i].tuple_offset); |
| 34 | if (sv->IsSmall()) continue; |
| 35 | total_len += sv->Len(); |
| 36 | } |
| 37 | char* buf = AllocateStrings(err_ctx, state, total_len, pool, status); |
| 38 | if (UNLIKELY(buf == nullptr)) return false; |
| 39 | for (int i = 0; i < num_string_slots; ++i) { |
| 40 | if (IsNull(string_slot_offsets[i].null_indicator_offset)) continue; |
| 41 | StringValue* sv = GetStringSlot(string_slot_offsets[i].tuple_offset); |
| 42 | if (sv->IsSmall()) continue; |
| 43 | StringValue::SimpleString s = sv->ToSimpleString(); |
| 44 | if (s.len == 0) continue; |
| 45 | memcpy(buf, s.ptr, s.len); |
| 46 | sv->SetPtr(buf); |
| 47 | buf += s.len; |
| 48 | } |
| 49 | return true; |
| 50 | } |
| 51 | |
| 52 | template<class T> |
| 53 | bool TryMemCopy(uint8_t* dst, const uint8_t* dst_end, int size, const T* src) { |
no test coverage detected