memcpy() replaced by memmove() in add_char()
This commit is contained in:
parent
3f39a7f11d
commit
2f676cbe2a
@ -1,3 +1,6 @@
|
|||||||
|
28 Nov 2006:
|
||||||
|
add_char() modified to use memmove() instead of memcpy()
|
||||||
|
|
||||||
02 Nov 2006:
|
02 Nov 2006:
|
||||||
getstring() modified to take the max string length as an argument
|
getstring() modified to take the max string length as an argument
|
||||||
updatestring() and todo_edit_item() created
|
updatestring() and todo_edit_item() created
|
||||||
|
@ -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
|
* Calcurse - text-based organizer
|
||||||
@ -129,14 +129,11 @@ void del_char(int pos, char *str)
|
|||||||
char *add_char(int pos, int ch, char *str)
|
char *add_char(int pos, int ch, char *str)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
char *buf;
|
|
||||||
|
|
||||||
str += pos;
|
str += pos;
|
||||||
len = strlen(str) + 1;
|
len = strlen(str) + 1;
|
||||||
buf = (char *) malloc(len);
|
memmove(str + 1, str, len);
|
||||||
(void)memcpy(buf, str, len);
|
*str = ch;
|
||||||
*str++ = ch;
|
|
||||||
(void)memcpy(str, buf, len);
|
|
||||||
return (str += len);
|
return (str += len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user