commit - f08447b045f0b36c3f6fb6186182c52e57c69680
commit + 32b9f7ede5545f25b13a16e6c8dab33462bbad8a
blob - 13a63450f67b8933ce15f3ef0dc354a5a903fb43
blob + 1af7140e25acfeb1a4a028714a9c3a473ea8513f
--- gotweb/gotweb.c
+++ gotweb/gotweb.c
if (TAILQ_EMPTY(&gw_trans->gw_dirs)) {
kerr = khtml_attr(gw_trans->gw_html_req, KELEM_DIV, KATTR_ID,
"index_wrapper", KATTR__MAX);
- if (kerr != KCGI_OK)
- return gw_kcgi_error(kerr);
- kerr = khtml_puts(gw_trans->gw_html_req,
- "No repositories found in ");
if (kerr != KCGI_OK)
return gw_kcgi_error(kerr);
- kerr = khtml_puts(gw_trans->gw_html_req,
+ kerr = khtml_printf(gw_trans->gw_html_req,
+ "No repositories found in %s",
gw_trans->gw_conf->got_repos_path);
if (kerr != KCGI_OK)
return gw_kcgi_error(kerr);
KATTR_ID, "refs_str", KATTR__MAX);
if (kerr != KCGI_OK)
goto done;
- kerr = khtml_puts(gw_trans->gw_html_req, "(");
- if (kerr != KCGI_OK)
- goto done;
- kerr = khtml_puts(gw_trans->gw_html_req,
+ kerr = khtml_printf(gw_trans->gw_html_req, "(%s)",
n_header->refs_str);
if (kerr != KCGI_OK)
goto done;
- kerr = khtml_puts(gw_trans->gw_html_req, ")");
- if (kerr != KCGI_OK)
- goto done;
kerr = khtml_closeelem(gw_trans->gw_html_req, 1);
if (kerr != KCGI_OK)
goto done;
KATTR_ID, "header_commit", KATTR__MAX);
if (kerr != KCGI_OK)
goto done;
- kerr = khtml_puts(gw_trans->gw_html_req, str1);
- if (kerr != KCGI_OK)
- goto done;
- kerr = khtml_puts(gw_trans->gw_html_req, " ");
+ kerr = khtml_printf(gw_trans->gw_html_req, "%s ", str1);
if (kerr != KCGI_OK)
goto done;
if (str2 != NULL) {
kerr = khtml_attr(gw_trans->gw_html_req, KELEM_SPAN,
KATTR_ID, "refs_str", KATTR__MAX);
- if (kerr != KCGI_OK)
- goto done;
- kerr = khtml_puts(gw_trans->gw_html_req, "(");
- if (kerr != KCGI_OK)
- goto done;
- kerr = khtml_puts(gw_trans->gw_html_req, str2);
if (kerr != KCGI_OK)
goto done;
- kerr = khtml_puts(gw_trans->gw_html_req, ")");
+ kerr = khtml_printf(gw_trans->gw_html_req, "(%s)", str2);
if (kerr != KCGI_OK)
goto done;
kerr = khtml_closeelem(gw_trans->gw_html_req, 1);
KATTR_HREF, href_commits, KATTR__MAX);
if (kerr != KCGI_OK)
goto done;
- kerr = khtml_puts(gw_trans->gw_html_req,
- "commits");
+ kerr = khtml_puts(gw_trans->gw_html_req, "commits");
if (kerr != KCGI_OK)
goto done;
kerr = khtml_closeelem(gw_trans->gw_html_req, 3);
while (bline->annotated) {
char *smallerthan, *at, *nl, *committer;
- char *lineno = NULL, *href_diff = NULL, *href_link = NULL;
+ char *href_diff = NULL;
size_t len;
if (getline(&line, &linesize, a->f) == -1) {
"blame_number", KATTR__MAX);
if (kerr != KCGI_OK)
goto err;
- if (asprintf(&lineno, "%.*d", a->nlines_prec,
- a->lineno_cur) == -1)
- goto err;
- kerr = khtml_puts(a->gw_trans->gw_html_req, lineno);
+ kerr = khtml_printf(a->gw_trans->gw_html_req, "%.*d",
+ a->nlines_prec, a->lineno_cur);
if (kerr != KCGI_OK)
goto err;
kerr = khtml_closeelem(a->gw_trans->gw_html_req, 1);
if (asprintf(&href_diff,
"?path=%s&action=diff&commit=%s",
a->gw_trans->repo_name, bline->id_str) == -1) {
- err = got_error_from_errno("asprintf");
- goto err;
- }
- if (asprintf(&href_link, "%.8s", bline->id_str) == -1) {
err = got_error_from_errno("asprintf");
goto err;
}
KATTR_HREF, href_diff, KATTR__MAX);
if (kerr != KCGI_OK)
goto done;
- kerr = khtml_puts(a->gw_trans->gw_html_req, href_link);
+ kerr = khtml_printf(a->gw_trans->gw_html_req, "%.8s",
+ bline->id_str);
if (kerr != KCGI_OK)
goto err;
kerr = khtml_closeelem(a->gw_trans->gw_html_req, 2);
a->lineno_cur++;
bline = &a->lines[a->lineno_cur - 1];
err:
- free(lineno);
free(href_diff);
- free(href_link);
}
done:
if (commit)
"diff_directory", KATTR__MAX);
if (kerr != KCGI_OK)
goto done;
- kerr = khtml_puts(gw_trans->gw_html_req,
- got_tree_entry_get_name(te));
- if (kerr != KCGI_OK)
- goto done;
- kerr = khtml_puts(gw_trans->gw_html_req, modestr);
+ kerr = khtml_printf(gw_trans->gw_html_req, "%s%s",
+ got_tree_entry_get_name(te), modestr);
if (kerr != KCGI_OK)
goto done;
kerr = khtml_closeelem(gw_trans->gw_html_req, 2);
goto done;
kerr = khtml_attr(gw_trans->gw_html_req, KELEM_A,
KATTR_HREF, href_blob, KATTR__MAX);
- if (kerr != KCGI_OK)
- goto done;
- kerr = khtml_puts(gw_trans->gw_html_req,
- got_tree_entry_get_name(te));
if (kerr != KCGI_OK)
goto done;
- kerr = khtml_puts(gw_trans->gw_html_req, modestr);
+ kerr = khtml_printf(gw_trans->gw_html_req, "%s%s",
+ got_tree_entry_get_name(te), modestr);
if (kerr != KCGI_OK)
goto done;
kerr = khtml_closeelem(gw_trans->gw_html_req, 2);
if (kerr != KCGI_OK)
goto done;
kerr = khtml_closeelem(gw_trans->gw_html_req, 1);
- if (kerr != KCGI_OK)
- goto done;
- kerr = khtml_puts(gw_trans->gw_html_req, " / ");
if (kerr != KCGI_OK)
goto done;
- kerr = khtml_puts(gw_trans->gw_html_req,
+ kerr = khtml_printf(gw_trans->gw_html_req, " / %s",
gw_get_action_name(gw_trans));
if (kerr != KCGI_OK)
goto done;