add experimental ast_copy_string() function to be used in place of strncpy() (see discussion on asterisk-dev)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5547 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kevin P. Fleming
2005-05-02 00:27:54 +00:00
parent 405000c897
commit abec217a1b
2 changed files with 38 additions and 4 deletions

View File

@@ -418,6 +418,15 @@ int ast_wait_for_input(int fd, int ms)
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)