page to string

This commit is contained in:
Neil 2022-05-27 23:15:21 -07:00
parent 68d2412d65
commit ba9e5d8e56
1 changed files with 4 additions and 7 deletions

View File

@ -116,6 +116,9 @@ struct page {
#define TREE_KEY union date32
#define TREE_VALUE struct page
#define TREE_COMPARE &date_mixup
#define TREE_EXPECT_TRAIT
#include "tree.h"
#define TREE_TO_STRING &entry_to_string
#include "tree.h"
static void entry_to_string(const struct page_tree_entry_c entry,
char (*const z)[12]) { date32_to_string(*entry.key, z); }
@ -249,6 +252,7 @@ int main(int argc, char **argv) {
break; /* fixme */
}
page_tree_bulk_finish(&journal);
printf("Journal has entries: %s\n", page_tree_to_string(&journal));
goto finally;
catch:
success = EXIT_FAILURE;
@ -268,12 +272,5 @@ finally:
lex_array_(&page->lexx);
char_array_(&page->entry);
}
/* Got up to creating a page, but didn't add to the journal. */
/*if(page) { lex_array_(&page->lexx); char_array(&page->entry); }
{
struct page *page;
while(page = page_array_pop(&journal))
lex_array_(&page->lexx), char_array_(&page->entry);
} memory leak! */
return success;
}