summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4d5f243)
raw | patch | inline | side by side (parent: 4d5f243)
author | Jonas Fonseca <fonseca@diku.dk> | |
Wed, 19 Mar 2008 19:08:38 +0000 (20:08 +0100) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Tue, 22 Apr 2008 23:10:11 +0000 (01:10 +0200) |
tig.c | patch | blob | history |
index 9e4d7938adc51e73c4e2f56150c29e4bc11750ce..67d0693f5f99dbee4913d0ca79b51b15712b6570 100644 (file)
--- a/tig.c
+++ b/tig.c
static enum request
add_run_request(enum keymap keymap, int key, int argc, char **argv)
{
- struct run_request *tmp;
- struct run_request req = { keymap, key };
+ struct run_request *req;
+ char cmd[SIZEOF_STR];
size_t bufpos;
for (bufpos = 0; argc > 0; argc--, argv++)
- if (!string_format_from(req.cmd, &bufpos, "%s ", *argv))
+ if (!string_format_from(cmd, &bufpos, "%s ", *argv))
return REQ_NONE;
- req.cmd[bufpos - 1] = 0;
-
- tmp = realloc(run_request, (run_requests + 1) * sizeof(*run_request));
- if (!tmp)
+ req = realloc(run_request, (run_requests + 1) * sizeof(*run_request));
+ if (!req)
return REQ_NONE;
- run_request = tmp;
- run_request[run_requests++] = req;
+ run_request = req;
+ req = &run_request[run_requests++];
+ string_copy(req->cmd, cmd);
+ req->keymap = keymap;
+ req->key = key;
return REQ_NONE + run_requests;
}
enum line_graphic {
- LINE_GRAPHIC_VLINE,
+ LINE_GRAPHIC_VLINE
};
static int line_graphics[] = {
OPEN_SPLIT = 1, /* Split current view. */
OPEN_BACKGROUNDED = 2, /* Backgrounded. */
OPEN_RELOAD = 4, /* Reload view even if it is the current. */
- OPEN_NOMAXIMIZE = 8, /* Do not maximize the current view. */
+ OPEN_NOMAXIMIZE = 8 /* Do not maximize the current view. */
};
static void
return FALSE;
}
} else {
- char buf[] = { status->status, ' ', ' ', ' ', 0 };
+ static char buf[] = { '?', ' ', ' ', ' ', 0 };
+ buf[0] = status->status;
if (draw_text(view, line->type, buf, TRUE))
return TRUE;
type = LINE_DEFAULT;