mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-16 14:58:25 +00:00
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:
9
utils.c
9
utils.c
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user