aboutsummaryrefslogtreecommitdiff
path: root/badroff.c
diff options
context:
space:
mode:
Diffstat (limited to 'badroff.c')
-rw-r--r--badroff.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/badroff.c b/badroff.c
index 3d96fc7..e73dd99 100644
--- a/badroff.c
+++ b/badroff.c
@@ -148,9 +148,7 @@ llnode* accumlines(size_t* ct){ // returns tail of linked list
endgroup = false; // prevents false positive on next run
return tail;
}
-char* lineset(char* txt){
- size_t ct;
- llnode* tail = accumlines(&ct);
+char* foldlines(llnode* tail, size_t ct){
sb* buf = newsb(100);
size_t oldbrk = 0, brk = 0;
@@ -178,8 +176,12 @@ char* lineset(char* txt){
}
}
- char* lines = decompose(buf);
- return lines;
+ return decompose(buf);
+}
+char* lineset(char* txt){
+ size_t ct;
+ llnode* tail = accumlines(&ct);
+ return foldlines(tail, ct);
}
char* emptalloc(void){ // need a null string so it can be freed later
char* str = malloc(sizeof(char)); str[0] = 0;