From 2f676cbe2a51e9495f56bdb561cdfbbff6ff5ecd Mon Sep 17 00:00:00 2001 From: Frederic Culot Date: Tue, 28 Nov 2006 15:28:43 +0000 Subject: memcpy() replaced by memmove() in add_char() --- src/utils.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/utils.c b/src/utils.c index 4403ed4..aace87d 100755 --- a/src/utils.c +++ b/src/utils.c @@ -1,4 +1,4 @@ -/* $calcurse: utils.c,v 1.13 2006/11/02 13:40:50 culot Exp $ */ +/* $calcurse: utils.c,v 1.14 2006/11/28 15:28:43 culot Exp $ */ /* * Calcurse - text-based organizer @@ -129,14 +129,11 @@ void del_char(int pos, char *str) char *add_char(int pos, int ch, char *str) { int len; - char *buf; str += pos; len = strlen(str) + 1; - buf = (char *) malloc(len); - (void)memcpy(buf, str, len); - *str++ = ch; - (void)memcpy(str, buf, len); + memmove(str + 1, str, len); + *str = ch; return (str += len); } -- cgit v1.2.3-70-g09d2