Diff options
Diffstat (limited to '')
-rw-r--r--source/ui-blame.c24
1 file changed, 6 insertions, 18 deletions
diff --git a/source/ui-blame.c b/source/ui-blame.c
index 2f79d68..5c8dbd6 100644
--- a/source/ui-blame.c
+++ b/source/ui-blame.c
@@ -151,19 +151,6 @@ static void emit_entry_hash(struct blame_entry *ent)
emit_chars('\n', ent->num_lines);
}
-static void emit_hashes(struct blame_scoreboard *sb)
-{
- struct blame_entry *ent;
-
- html("<td class='hashes'>");
- for (ent = sb->ent; ent; ent = ent->next) {
- html("<div class='alt'><pre>");
- emit_entry_hash(ent);
- html("</pre></div>");
- }
- html("</td>\n");
-}
-
static void emit_entry_linenumbers(struct blame_entry *ent)
{
struct strbuf numbers = STRBUF_INIT;
@@ -181,14 +168,15 @@ static void emit_entry_linenumbers(struct blame_entry *ent)
strbuf_release(&numbers);
}
-static void emit_linenumbers(struct blame_scoreboard *sb)
+static void emit_column(struct blame_scoreboard *sb, const char *class,
+ void (*emit_entry)(struct blame_entry *ent))
{
struct blame_entry *ent;
- html("<td class='linenumbers'>");
+ htmlf("<td class='%s'>", class);
for (ent = sb->ent; ent; ent = ent->next) {
html("<div class='alt'><pre>");
- emit_entry_linenumbers(ent);
+ emit_entry(ent);
html("</pre></div>");
}
html("</td>\n");
@@ -310,10 +298,10 @@ static void print_blame_page(const struct object_id *oid, const char *path,
}
html("<table class='blame blob'>\n<tr>\n");
- emit_hashes(&sb);
+ emit_column(&sb, "hashes", emit_entry_hash);
if (ctx.cfg.enable_tree_linenumbers)
- emit_linenumbers(&sb);
+ emit_column(&sb, "linenumbers", emit_entry_linenumbers);
html("<td class='lines'><div>");
emit_line_backgrounds(&sb);