stagit

static git page generator (mirror)
git clone git://git.2f30.org/stagit
Log | Files | Refs | README | LICENSE

commit 21ffbb062e903b7cc150d87ba7d4061266d17435
parent 5fdaca3a10e30b716cec7543f89609a3c219699b
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Wed,  9 Dec 2015 21:02:49 +0100

also free objects for haslicense and hasreadme checks, cleanup

Diffstat:
Murmoms.c | 18+++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/urmoms.c b/urmoms.c @@ -539,7 +539,7 @@ writefiles(FILE *fp) int main(int argc, char *argv[]) { - git_object *obj = NULL; + git_object *obj_license = NULL, *obj_readme = NULL; const git_error *e = NULL; FILE *fp, *fpread; char path[PATH_MAX], *p; @@ -579,17 +579,17 @@ main(int argc, char *argv[]) } /* check LICENSE */ - haslicense = !git_revparse_single(&obj, repo, "HEAD:LICENSE"); + haslicense = !git_revparse_single(&obj_license, repo, "HEAD:LICENSE"); /* check README */ - hasreadme = !git_revparse_single(&obj, repo, "HEAD:README"); + hasreadme = !git_revparse_single(&obj_readme, repo, "HEAD:README"); /* read LICENSE */ - if (!git_revparse_single(&obj, repo, "HEAD:LICENSE")) { + if (haslicense) { fp = efopen("license.html", "w+b"); writeheader(fp); fputs("<pre>\n", fp); - writeblobhtml(fp, (git_blob *)obj); - git_object_free(obj); + writeblobhtml(fp, (git_blob *)obj_license); + git_object_free(obj_license); if (ferror(fp)) err(1, "fwrite"); fputs("</pre>\n", fp); @@ -599,12 +599,12 @@ main(int argc, char *argv[]) } /* read README */ - if (!git_revparse_single(&obj, repo, "HEAD:README")) { + if (hasreadme) { fp = efopen("readme.html", "w+b"); writeheader(fp); fputs("<pre>\n", fp); - writeblobhtml(fp, (git_blob *)obj); - git_object_free(obj); + writeblobhtml(fp, (git_blob *)obj_readme); + git_object_free(obj_readme); if (ferror(fp)) err(1, "fwrite"); fputs("</pre>\n", fp);