commit 9b929b3a6a042fe05021406a864aa9d9a59ff537 from: Omar Polo date: Thu Sep 29 09:44:21 2022 UTC template: add a template_free function commit - 2871d3cec541fec15df6e963204e8235a439c2a3 commit + 9b929b3a6a042fe05021406a864aa9d9a59ff537 blob - 4cd589aa6877e36404e10e7bc59a5504d9548d55 blob + c09d3b9a06921d1759263225b112bbeb5741f4b2 --- template/tmpl.c +++ template/tmpl.c @@ -103,3 +103,10 @@ template_reset(struct template *tp) { tp->tp_ret = 0; } + +void +template_free(struct template *tp) +{ + free(tp->tp_tmp); + free(tp); +} blob - 8feca604eb6abd04507d15d39f8f0d847d55fbc9 blob + 0de4f24796d823d76a6882bca883da23eb005c74 --- template/tmpl.h +++ template/tmpl.h @@ -24,6 +24,7 @@ typedef int (*tmpl_putc)(struct template *, int); struct template { void *tp_arg; + char *tp_tmp; tmpl_puts tp_escape; tmpl_puts tp_puts; tmpl_putc tp_putc; @@ -38,5 +39,6 @@ int tp_htmlescape(struct template *, const char *); struct template *template(void *, tmpl_puts, tmpl_putc); void template_reset(struct template *); +void template_free(struct template *); #endif