barectf/templates: use `loop.last` instead of hack in `barectf/cgen.py`
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 24 Sep 2020 16:11:08 +0000 (12:11 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 24 Sep 2020 17:05:54 +0000 (13:05 -0400)
commitf42a1daf96d7aa843095efbf4f9716289a0f7ab4
treeefe4f76ad7d6299655fca6eb133a2dc563756e63
parent87e40eabac022848cc4b519db9e16929f4921471
barectf/templates: use `loop.last` instead of hack in `barectf/cgen.py`

This patch removes the raw text replacement at the end of
_CodeGen.gen_src() (`barectf/cgen.py`).

Instead, to avoid empty lines before `}`, Jinja 2 templates only
output an empty line it's not the loop's last iteration:

    {% if not loop.last %}{{ '\n' }}{% endif %}

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
barectf/cgen.py
barectf/templates/c/barectf.c.j2
barectf/templates/c/barectf.h.j2
barectf/templates/c/serialize-write-array-statements.j2
barectf/templates/c/serialize-write-struct-statements.j2
barectf/templates/c/size-write-array-statements.j2
barectf/templates/c/size-write-struct-statements.j2
This page took 0.025511 seconds and 4 git commands to generate.