projects
/
sdk
/
emulator
/
qemu.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7977208
)
readline: use g_strndup instead of open-coding it
author
Michael Tokarev
<mjt@tls.msk.ru>
Mon, 5 May 2014 09:23:50 +0000
(13:23 +0400)
committer
Michael Tokarev
<mjt@tls.msk.ru>
Wed, 7 May 2014 17:00:43 +0000
(21:00 +0400)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Andreas Färber <afaerber@suse.de>
util/readline.c
patch
|
blob
|
history
diff --git
a/util/readline.c
b/util/readline.c
index
8441be4
..
a3fd2cb
100644
(file)
--- a/
util/readline.c
+++ b/
util/readline.c
@@
-279,9
+279,7
@@
static void readline_completion(ReadLineState *rs)
rs->nb_completions = 0;
- cmdline = g_malloc(rs->cmd_buf_index + 1);
- memcpy(cmdline, rs->cmd_buf, rs->cmd_buf_index);
- cmdline[rs->cmd_buf_index] = '\0';
+ cmdline = g_strndup(rs->cmd_buf, rs->cmd_buf_index);
rs->completion_finder(rs->opaque, cmdline);
g_free(cmdline);