MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / operator+=

Method operator+=

Descent3/localization.cpp:661–685  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

659GrowString::~GrowString() { Destroy(); }
660
661void 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
687void GrowString::Destroy(void) {
688 if (root.string_data)

Callers

nothing calls this directly

Calls 1

GetStringMethod · 0.80

Tested by

no test coverage detected