r15302: Remove strangely named function "StrnCpy" - strlcpy is available as a
authorJelmer Vernooij <jelmer@samba.org>
Thu, 27 Apr 2006 22:59:20 +0000 (22:59 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:05:08 +0000 (14:05 -0500)
replacement.
(This used to be commit 72237344cf22dacfaf1d87c3e0b922023fa4afb0)

source4/lib/util/util_str.c
source4/param/loadparm.c

index 60419e0510ab7f3c04919c065626b1f9c4056a8f..34d37ecfbdd7cf69e7cd0f90c243abb245230a0e 100644 (file)
@@ -171,27 +171,6 @@ _PUBLIC_ char *safe_strcat(char *dest, const char *src, size_t maxlength)
        return dest;
 }
 
-/**
- Like strncpy but always null terminates. Make sure there is room!
- The variable n should always be one less than the available size.
-**/
-
-_PUBLIC_ char *StrnCpy(char *dest,const char *src,size_t n)
-{
-       char *d = dest;
-       if (!dest)
-               return(NULL);
-       if (!src) {
-               *dest = 0;
-               return(dest);
-       }
-       while (n-- && (*d++ = *src++))
-               ;
-       *d = 0;
-       return(dest);
-}
-
-
 /**
  Routine to get hex characters and turn them into a 16 byte array.
  the array can be variable length, and any non-hex-numeric
index a033e0815c6847d6dd94efdcb9065f2d2ed4956a..b6dec9be9de0f025491716e9c2476974754c0289 100644 (file)
@@ -759,11 +759,11 @@ static const char *lp_string(const char *s)
        if (!s)
                *ret = 0;
        else
-               StrnCpy(ret, s, len);
+               strlcpy(ret, s, len);
 
        if (trim_string(ret, "\"", "\"")) {
                if (strchr(ret,'"') != NULL)
-                       StrnCpy(ret, s, len);
+                       strlcpy(ret, s, len);
        }
 
        standard_sub_basic(ret,len+100);