Mercurial > hg > th-libs
diff th_string.c @ 79:909ae72c0763
Remove th_strncpy().
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 04 May 2013 03:37:21 +0300 |
parents | 34d58b0f2d52 |
children | 12f1af4ffc6d |
line wrap: on
line diff
--- a/th_string.c Thu Feb 28 09:59:23 2013 +0200 +++ b/th_string.c Sat May 04 03:37:21 2013 +0300 @@ -24,33 +24,11 @@ } -char *th_strncpy(char *dst, const char *src, const size_t n) { - const char *s = src; - char *d = dst; - size_t i; - assert(src != NULL); - assert(dst != NULL); + - /* Copy to the destination */ - i = n; - while (*s && i > 0) - { - *(d++) = *(s++); - i--; - } - /* Fill rest of space with zeros */ - while (i > 0) - { - *(d++) = 0; - i--; - } - /* Ensure that last is always zero */ - dst[n - 1] = 0; - - return dst; }