ref: 71faea8a526080f9912ed7b0d14980246998ae4c
parent: c1d5de86be53c8600246fde4f9c1f59eb2706a15
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Fri Aug 11 09:14:22 EDT 2023
a bit of style
--- a/main.c
+++ b/main.c
@@ -22,6 +22,7 @@
{
int ret;
Page p;
+
pageinit(&p, page);
ret = pagerender(&p);
if(ret){
@@ -32,6 +33,7 @@
writememimage(1, p.image);
}
pagefree(&p);
+
return ret;
}
@@ -40,9 +42,11 @@
{
Object *page, *kids, *type;
int i, count;
+
kids = dictget(pages, "Kids");
count = arraylen(kids);
- for(i = 0; i < count; i += 1){
+
+ for(i = 0; i < count; i++){
page = arrayget(kids, i);
// Must be a dict, either Page or Pages
type = dictget(page, "Type");
@@ -50,14 +54,12 @@
if(strcmp(type->name, "Pages") == 0){
if(!dumppages(page, text))
return 0;
- }
- else if(strcmp(type->name, "Page") == 0){
+ }else if(strcmp(type->name, "Page") == 0){
if(!dumppage(page, text))
return 0;
if(text)
print("\n");
- }
- else
+ }else
sysfatal("Unexpected page node type '%s'", type->name);
}
return 1;
--- a/object.c
+++ b/object.c
@@ -36,6 +36,7 @@
{
int sz, c;
char buf[8];
+
for(sz = 0; sz < 7; sz += 1){
c = Sgetc(s);
if(c < 0)
@@ -47,6 +48,7 @@
buf[sz] = c;
}
buf[sz] = 0;
+
return strdup(buf);
}