| 659 | GrowString::~GrowString() { Destroy(); } |
| 660 | |
| 661 | void GrowString::operator+=(char *str) { |
| 662 | if (!str) |
| 663 | return; |
| 664 | if (root.string_data) { |
| 665 | tbufferinfo *node; |
| 666 | node = (tbufferinfo *)mem_malloc(sizeof(tbufferinfo)); |
| 667 | if (!node) |
| 668 | return; |
| 669 | node->string_data = (char *)mem_malloc(strlen(str) + 2); |
| 670 | if (!node->string_data) { |
| 671 | mem_free(node); |
| 672 | return; |
| 673 | } |
| 674 | sprintf(node->string_data, "\n%s", str); |
| 675 | curr->next = node; |
| 676 | node->next = NULL; |
| 677 | curr = node; |
| 678 | } else { |
| 679 | root.string_data = (char *)mem_malloc(strlen(str) + 1); |
| 680 | if (!root.string_data) |
| 681 | return; |
| 682 | strcpy(root.string_data, str); |
| 683 | root.next = NULL; |
| 684 | } |
| 685 | } |
| 686 | |
| 687 | void GrowString::Destroy(void) { |
| 688 | if (root.string_data) |