Update of /usr/cvsroot/asterisk
In directory localhost.localdomain:/tmp/cvs-serv23801
Modified Files:
utils.c
Log Message:
add experimental ast_copy_string() function to be used in place of strncpy()
(see discussion on asterisk-dev)
Index: utils.c
===================================================================
RCS file: /usr/cvsroot/asterisk/utils.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- utils.c 22 Apr 2005 13:11:34 -0000 1.39
+++ utils.c 2 May 2005 00:27:54 -0000 1.40
@@ -418,6 +418,15 @@
return poll(pfd, 1, ms);
}
+void ast_copy_string(char *dst, const char *src, size_t size)
+{
+ while (*src && size--)
+ *dst++ = *src++;
+ if (__builtin_expect(!size, 0))
+ dst--;
+ *dst = '\0';
+}
+
/* Case-insensitive substring matching */
#ifndef LINUX
static char *upper(const char *orig, char *buf, int bufsize)
_______________________________________________
Asterisk-Cvs mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-cvs