summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a72bf50)
raw | patch | inline | side by side (parent: a72bf50)
author | Jonas Fonseca <fonseca@diku.dk> | |
Tue, 7 Oct 2008 18:42:23 +0000 (20:42 +0200) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Tue, 7 Oct 2008 18:46:34 +0000 (20:46 +0200) |
tig.c | patch | blob | history |
index 3da49f2855b25cf0546c3c284557002f1c8a685e..51cbb2043c1a41d0c0cd7c7fac09badb0d5b953e 100644 (file)
--- a/tig.c
+++ b/tig.c
* Incremental updating
*/
+static void
+reset_view(struct view *view)
+{
+ int i;
+
+ for (i = 0; i < view->lines; i++)
+ free(view->line[i].data);
+ free(view->line);
+
+ view->line = NULL;
+ view->offset = 0;
+ view->lines = 0;
+ view->lineno = 0;
+ view->line_size = 0;
+ view->line_alloc = 0;
+ view->vid[0] = 0;
+}
+
static void
end_update(struct view *view, bool force)
{
return FALSE;
set_nonblocking_input(TRUE);
-
- view->offset = 0;
- view->lines = 0;
- view->lineno = 0;
+ reset_view(view);
string_copy_rev(view->vid, view->id);
- if (view->line) {
- int i;
-
- for (i = 0; i < view->lines; i++)
- if (view->line[i].data)
- free(view->line[i].data);
-
- free(view->line);
- view->line = NULL;
- }
-
view->start_time = time(NULL);
return TRUE;
if (!string_format(view->cmd, BLAME_INCREMENTAL_CMD, ref, path))
return FALSE;
+ reset_view(view);
string_format(view->ref, "%s ...", opt_file);
string_copy_rev(view->vid, opt_file);
set_nonblocking_input(TRUE);
-
- if (view->line) {
- int i;
-
- for (i = 0; i < view->lines; i++)
- free(view->line[i].data);
- free(view->line);
- }
-
- view->lines = view->line_alloc = view->line_size = view->lineno = 0;
- view->offset = view->lines = view->lineno = 0;
- view->line = NULL;
view->start_time = time(NULL);
return TRUE;
status_open(struct view *view)
{
unsigned long prev_lineno = view->lineno;
- size_t i;
- for (i = 0; i < view->lines; i++)
- free(view->line[i].data);
- free(view->line);
- view->lines = view->line_alloc = view->line_size = view->lineno = 0;
- view->line = NULL;
+ reset_view(view);
if (!realloc_lines(view, view->line_size + 7))
return FALSE;