Commits


parser: make parser_set_buf() private


parsers: don't error on empty documents See https://codeberg.org/telescope-browser/telescope/pulls/32


parser: make parser_append() private


code: add wrappers for common failure cases Certain calls to well-known functions sometimes result in similar error handling across the code base. Sometimes there's a need to centralise the failure case. Achieve this for common wrappers to often-used functions. The transformation is achieved via coccinelle, commited with this patch. Note that coccinelle can be told to ignore code blocks with comment delimiters. This transformation applies just to telescope's code, and not any of the bundled depdencies in telescope (libgrapheme).


constify the parser structs


untangle a bit buffers and parsers Now buffers have a nicer interface, taking explicitly the buffer where they push stuff, and the code that deals with buffers doesn't need to peek into the parsers. The parsers now are 'pure' structs without state attached to them, the state was moved to the buffer.


parser: make parser_foreach_line private while here also inline fn: it's always p->parseline.


parsers: plug a leak since the free() method was made optional, all parsers except text/gemini are leaking the buffer. Instead, move the free(p->buf) in the parser_free() layer.


parsers: add a parseline method all our parsers just need a line to parse and don't always need the free method. The gemtext parser could also be simplified with this, but defer it for later.


move all the sources back in the root directory subdir is just messier for no good reason