aboutsummaryrefslogtreecommitdiffstats
path: root/utils.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-05-02 00:27:54 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-05-02 00:27:54 +0000
commitc941fb14b694de4abf7cb9603e4c139689b2cd92 (patch)
treec3af4fd05dc8b9044bda48c492c562751ae7891b /utils.c
parent4186279fc1dbf4471c1666bc0df2e688a45cd229 (diff)
add experimental ast_copy_string() function to be used in place of strncpy() (see discussion on asterisk-dev)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5547 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'utils.c')
-rwxr-xr-xutils.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/utils.c b/utils.c
index 742b4872e..b73e4fcdb 100755
--- a/utils.c
+++ b/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)