diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-01-10 12:32:04 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-01-10 12:45:58 +0100 |
| commit | b1c4b7249a33098ca7f2e8f2b786e969493dddcf (patch) | |
| tree | 1a9db1a93281d5b4a8ccef3a68c9a1fb447cda73 /ui-curses.c | |
| parent | e6e077c8469f857ac58d804c788e887ce86e2303 (diff) | |
| download | vis-b1c4b7249a33098ca7f2e8f2b786e969493dddcf.tar.gz vis-b1c4b7249a33098ca7f2e8f2b786e969493dddcf.tar.xz | |
Simplify code by using text_bytes_alloc0
Diffstat (limited to 'ui-curses.c')
| -rw-r--r-- | ui-curses.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/ui-curses.c b/ui-curses.c index a9ae5f9..0bfd9d8 100644 --- a/ui-curses.c +++ b/ui-curses.c @@ -988,12 +988,7 @@ static char *ui_prompt_input(Ui *ui) { if (!uic->prompt_win) return NULL; Text *text = vis_file_text(uic->prompt_win->file); - char *buf = malloc(text_size(text) + 1); - if (!buf) - return NULL; - size_t len = text_bytes_get(text, 0, text_size(text), buf); - buf[len] = '\0'; - return buf; + return text_bytes_alloc0(text, 0, text_size(text)); } static void ui_prompt_hide(Ui *ui) { |
