ref: d198a27db6689d240e045f390986d31751c466dc
parent: 9163e4a8c82e02a3401b6a52d64c141b36c343b4
author: gek169 <gek169>
date: Wed May 12 17:09:17 EDT 2021
Automatic commit.
--- a/include-demo/stringutil.h
+++ b/include-demo/stringutil.h
@@ -380,20 +380,19 @@
/*Make Child*/
static strll* consume_until(strll* current_node, const char* find_me, const char delete_findable){
- long loc; strll* right_old;
+ long loc; strll* right_old; char* text_old;
loc = strfind(current_node->text, find_me);
if(loc < 0){ /*Nothing to do!*/
return current_node;
}
/*loc was not -1.*/
- current_node->child = STRUTIL_CALLOC(1, sizeof(strll));
right_old = current_node->right;
current_node->right = STRUTIL_CALLOC(1, sizeof(strll));
current_node->right->right = right_old;
- current_node->child->text = str_null_terminated_alloc(current_node->text,loc + (delete_findable?strlen(find_me):0));
- current_node->right->text = strcatalloc(current_node->text + loc + strlen(find_me),"");
- STRUTIL_FREE(current_node->text);
- current_node->text = NULL;
+ text_old = current_node->text;
+ current_node->text = str_null_terminated_alloc(text_old,loc + (delete_findable?strlen(find_me):0));
+ current_node->right->text = strcatalloc(text_old + loc + strlen(find_me),"");
+ STRUTIL_FREE(text_old);
return current_node->right;
}