commit - b0ca5974978442dcb7693e8d91e3293ca8823b7f
commit + 5d1296dec4126178e32f8c775b0e6d65149f1810
blob - 40063a5d67ea18ad18e49dbb02fe160c89a14ecd
blob + 8f1eb4b6da217e2cfb03af2c4bd46d3a3ee3db90
--- gotweb/gotweb.c
+++ gotweb/gotweb.c
char *commit;
char *repo_file;
char *repo_folder;
- char *action_name;
char *headref;
unsigned int action;
unsigned int page;
{ GW_TAG, "tag", gw_tag, "gw_tmpl/tag.tmpl" },
{ GW_TREE, "tree", gw_tree, "gw_tmpl/tree.tmpl" },
};
+
+static const char *
+gw_get_action_name(struct gw_trans *gw_trans)
+{
+ return gw_query_funcs[gw_trans->action].func_name;
+}
static const struct got_error *
gw_kcgi_error(enum kcgi_err kerr)
strcmp(action->func_name, p->parsed.s))
continue;
- if (asprintf(&gw_trans->action_name, "%s",
- action->func_name) == -1)
- return got_error_from_errno("asprintf");
-
gw_trans->action = i;
break;
}
}
if (asprintf(&href_blob,
"?path=%s&action=%s&commit=%s&folder=%s",
- gw_trans->repo_name, gw_trans->action_name,
+ gw_trans->repo_name, gw_get_action_name(gw_trans),
gw_trans->commit, build_folder) == -1) {
error = got_error_from_errno("asprintf");
goto done;
kerr = khtml_puts(gw_trans->gw_html_req, " / ");
if (kerr != KCGI_OK)
goto done;
- kerr = khtml_puts(gw_trans->gw_html_req, gw_trans->action_name);
+ kerr = khtml_puts(gw_trans->gw_html_req,
+ gw_get_action_name(gw_trans));
if (kerr != KCGI_OK)
goto done;
}
free(gw_trans->repo_path);
free(gw_trans->repo_name);
free(gw_trans->repo_file);
- free(gw_trans->action_name);
free(gw_trans->headref);
TAILQ_FOREACH_SAFE(dir, &gw_trans->gw_dirs, entry, tdir) {