summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f098944)
raw | patch | inline | side by side (parent: f098944)
author | Jonas Fonseca <fonseca@diku.dk> | |
Wed, 30 May 2007 18:22:04 +0000 (20:22 +0200) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Wed, 30 May 2007 18:22:50 +0000 (20:22 +0200) |
tig.c | patch | blob | history |
index be4b80c774d44902a1160f271d5bc4c8a11bdef8..ca380a30a6d3b9eac6eed506a78c3b09ee96cf66 100644 (file)
--- a/tig.c
+++ b/tig.c
}
static struct line *
-add_line_text(struct view *view, char *data, enum line_type type)
+add_line_data(struct view *view, void *data, enum line_type type)
{
- struct line *line = &view->line[view->lines];
-
- if (!data)
- return NULL;
-
- line->data = strdup(data);
- if (!line->data)
- return NULL;
+ struct line *line = &view->line[view->lines++];
+ memset(line, 0, sizeof(*line));
line->type = type;
- view->lines++;
+ line->data = data;
return line;
}
+static struct line *
+add_line_text(struct view *view, char *data, enum line_type type)
+{
+ if (data)
+ data = strdup(data);
+
+ return data ? add_line_data(view, data, type) : NULL;
+}
+
/*
* View opening
line += STRING_SIZE("commit ");
- view->line[view->lines++].data = commit;
string_copy_rev(commit->id, line);
commit->refs = get_refs(commit->id);
graph->commit = commit;
+ add_line_data(view, commit, LINE_MAIN_COMMIT);
break;
case LINE_PARENT: