aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--read.c12
1 files 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) {