summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2006-11-28 15:28:43 +0000
committerFrederic Culot <calcurse@culot.org>2006-11-28 15:28:43 +0000
commit2f676cbe2a51e9495f56bdb561cdfbbff6ff5ecd (patch)
tree9289629b7469ea32d8e26cebb00d1bc9ce476723
parent3f39a7f11de32648a3a471a30b69fb8e21251ac5 (diff)
downloadcalcurse-2f676cbe2a51e9495f56bdb561cdfbbff6ff5ecd.tar.gz
calcurse-2f676cbe2a51e9495f56bdb561cdfbbff6ff5ecd.zip
memcpy() replaced by memmove() in add_char()
-rwxr-xr-xChangeLog3
-rwxr-xr-xsrc/utils.c9
2 files changed, 6 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 2816587..900770d 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+28 Nov 2006:
+ add_char() modified to use memmove() instead of memcpy()
+
02 Nov 2006:
getstring() modified to take the max string length as an argument
updatestring() and todo_edit_item() created
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);
}