[FFmpeg-cvslog] r9391 - trunk/libavformat/cutils.c
mru
subversion
Sat Jun 23 02:21:07 CEST 2007
Author: mru
Date: Sat Jun 23 02:21:06 2007
New Revision: 9391
Log:
simplify pstrcpy()
Modified:
trunk/libavformat/cutils.c
Modified: trunk/libavformat/cutils.c
==============================================================================
--- trunk/libavformat/cutils.c (original)
+++ trunk/libavformat/cutils.c Sat Jun 23 02:21:06 2007
@@ -75,19 +75,12 @@ int stristart(const char *str, const cha
*/
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. */
More information about the ffmpeg-cvslog
mailing list