Commit 63bae1c9 authored by mru's avatar mru

simplify pstrcpy()


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@9391 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent d06e6242
......@@ -75,19 +75,12 @@ int stristart(const char *str, const char *val, const char **ptr)
*/
void pstrcpy(char *buf, int buf_size, const char *str)
{
int c;
char *q = buf;
if (buf_size <= 0)
return;
for(;;) {
c = *str++;
if (c == 0 || q >= buf + buf_size - 1)
break;
*q++ = c;
}
*q = '\0';
while (buf_size-- > 1 && *str)
*buf++ = *str++;
*buf = 0;
}
/* strcat and truncate. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment