diff options
author | Jérémie Courrèges-Anglas <jca@wxcvbn.org> | 2014-03-04 02:59:13 +0100 |
---|---|---|
committer | Jérémie Courrèges-Anglas <jca@wxcvbn.org> | 2014-03-04 02:59:13 +0100 |
commit | d714a5a2776c0afc6397a9e89adc328eaa75ca8f (patch) | |
tree | b4646498e8ff5e9bf33f4fd347e0e1a92e5f9ff7 | |
parent | 131be4c952fe939c210fd8bb649dae5e414d4fcc (diff) | |
download | ratpoison-d714a5a2776c0afc6397a9e89adc328eaa75ca8f.zip |
strncpy -> memcpy.
* we NUL-terminate it anyway
* kill a useless "* sizeof (char)" while here
-rw-r--r-- | src/editor.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/editor.c b/src/editor.c index f3c82a6..e4046c1 100644 --- a/src/editor.c +++ b/src/editor.c @@ -548,8 +548,8 @@ editor_complete (rp_input_line *line, int direction) /* Create our partial string that will be used for completion. It is the characters up to the position of the cursor. */ - tmp = xmalloc ((line->position + 1) * sizeof (char)); - strncpy (tmp, line->buffer, line->position); + tmp = xmalloc (line->position + 1); + memcpy (tmp, line->buffer, line->position); tmp[line->position] = '\0'; /* We don't need to free s because it's a string from the completion |