changeset 79:909ae72c0763

Remove th_strncpy().
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 04 May 2013 03:37:21 +0300
parents 2579250f2a84
children 12f1af4ffc6d
files th_string.c th_string.h
diffstat 2 files changed, 1 insertions(+), 24 deletions(-) [+]
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;
 }
 
 
--- a/th_string.h	Thu Feb 28 09:59:23 2013 +0200
+++ b/th_string.h	Sat May 04 03:37:21 2013 +0300
@@ -42,7 +42,6 @@
 
 /* Normal NUL-terminated string functions
  */
-char    *th_strncpy(char *, const char *, size_t);
 int     th_strcasecmp(const char *, const char *);
 int     th_strncasecmp(const char *, const char *, size_t);
 void    th_strip_ctrlchars(char *);