From a98c7d4ef01272e02d5cacec49a902d5da188d22 Mon Sep 17 00:00:00 2001
From: Holden Rohrer
Date: Wed, 27 May 2020 21:53:05 -0400
Subject: resolvell resetting moved to mainloop
---
read.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/read.c b/read.c
index 069c819..cd71702 100644
--- a/read.c
+++ b/read.c
@@ -76,12 +76,9 @@ link* addbstlink(strbst* tree, char* name, node* to) {
return l;
}
-char* resolvell(llnode* head, size_t* sz) {
- llnode* tail = head->next;
- head->next = NULL;
+char* resolvell(llnode* tail, size_t sz) {
char *out, *pos;
- pos = out = malloc(sizeof(char)*(*sz+1)); out[*sz] = 0;
- *sz = 0;
+ pos = out = malloc(sizeof(char)*(sz+1)); out[sz] = 0;
while (tail != NULL) {
size_t len = strlen(tail->str);
memcpy(pos, tail->str, len);
@@ -108,7 +105,10 @@ node* readfile(char* name) {
int c;
while ( ( c = fgetc(read) ) != EOF ) {
if (c == ':' || c == '-') {
- curl->desc = resolvell(head, &sz);
+ curl->desc = resolvell(head->next, sz);
+ head->next = NULL;
+ tail = head;
+ sz = 0;
consumespaces(read);
}
switch (c) {
--
cgit