| 785 | |
| 786 | |
| 787 | String *copy_if_not_alloced(String *to,String *from,uint32 from_length) |
| 788 | { |
| 789 | if (from->Alloced_length >= from_length) |
| 790 | return from; |
| 791 | if ((from->alloced && (from->Alloced_length != 0)) || !to || from == to) |
| 792 | { |
| 793 | (void) from->realloc(from_length); |
| 794 | return from; |
| 795 | } |
| 796 | if (to->realloc(from_length)) |
| 797 | return from; // Actually an error |
| 798 | if ((to->str_length=min(from->str_length,from_length))) |
| 799 | memcpy(to->Ptr,from->Ptr,to->str_length); |
| 800 | to->str_charset=from->str_charset; |
| 801 | return to; |
| 802 | } |
| 803 | |
| 804 | |
| 805 | /**************************************************************************** |