Commit Briefs
gotwebd: drop superfluous check
commit_id is not NULL if got_repo_match_object_id returned successfully. ok stsp@
gotwebd: avoid extra variable in got_output_repo_tree
in_repo_path was used only to build a path, it's then assigned to path (which is NULL at that point.) Just asprintf into path. ok stsp@
gotwebd: plugs leaks in got_get_repo_commits
call got_get_repo_commit only once and avoid leaking the field of repo_commit at each loop iteration. ok stsp@
gotwebd: always free ref in got_get_repo_commits
some code-paths may leak it. ok stsp@
gotwebd: don't close tag in got_get_repo_tags too early
it's still used a bit later, so defer the free'ing at the next loop iteration or at function end.
gotwebd: free commit_msg0 only at the end of got_get_repo_tags
in case of a failure between when it's allocated and when it's released it might get leaked otherwise. ok and semplification stsp@
gotwebd: free all allocated fields of repo_tag
got_get_repo_tags needs some tweaking to how tag_commit is allocated too. ok stsp@
gotwebd: fix possible leaks when handling errors
all very unlikely. part of a bigger diff that's ok stsp@
gotwebd: minor tweaks
drop: - a tautological s[strlen(s)] == '\0' - a few duplicates checks - a lone if (error) when it's always NULL - an extra NULL check part of a bigger diff that's ok stsp@
gotwebd: make sure to escape possibly unsafe strings
this fixes only the HTML escaping of strings, the urlencode is still missig. while here also plug a memory leak in gotweb_render_branches and drop some needless ternary operators. ok tracey@
gotwebd: add fcgi_printf
instead of fcgi_gen_response which outputs only a fixed strings provide a printf-like fcgi_printf: it greatly simplifies the generation of the HTML pages. While here also (probably) fix some HTML errors: the output was verified with the W3C validator and it's correct (in the sense that the tags are properly closed, there are still some other things the validator complains about.) ok/encouragement baseprime@, ok jamsek Thanks for reading such a boring diff!
fix overflow in blame callback
spotted by noticing gotwebd crashing on some blame requests. Diff from stsp@ with a fix from tracey@, I'm committing it only because he is short on time. ok stsp@
gotwebd: fix alternate colors in tree entries
it was broken in 7ecc454 because now we're emitting tags with multiple `class' attributes (by mistake) and only the first one is used. However, instead of fixing the HTML `class' attribute, use a CSS selector to alternate the background colors. ok tracey@
gotwebd: switch some HTML IDs to classes
HTML IDs are meant to be unique across the page. While here fix two small errors in the generated HTML (one missing closing div and one extra.) ok tracey@