]> granicus.if.org Git - openssl/commitdiff
move some string utilities to buf_str.c to reduce some dependencies (from 0.9.8 branch).
authorDr. Stephen Henson <steve@openssl.org>
Sun, 9 Jan 2011 13:30:34 +0000 (13:30 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Sun, 9 Jan 2011 13:30:34 +0000 (13:30 +0000)
crypto/buffer/Makefile
crypto/buffer/buffer.c

index 9f3a88d2d6a13e37a44e558dbfce52673efe9c2c..d0e0d5f8967a281cf96c09bddb7c6c3f0303eb1e 100644 (file)
@@ -17,8 +17,8 @@ TEST=
 APPS=
 
 LIB=$(TOP)/libcrypto.a
-LIBSRC= buffer.c buf_err.c
-LIBOBJ= buffer.o buf_err.o
+LIBSRC= buffer.c buf_str.c buf_err.c
+LIBOBJ= buffer.o buf_str.o buf_err.o
 
 SRC= $(LIBSRC)
 
index 620ea8d5368a678c644696c0c7f650ea9ed8c085..f4b358bbbd674fab32b11a64ce0aba16b769d76a 100644 (file)
@@ -162,64 +162,6 @@ int BUF_MEM_grow_clean(BUF_MEM *str, size_t len)
        return(len);
        }
 
-char *BUF_strdup(const char *str)
-       {
-       if (str == NULL) return(NULL);
-       return BUF_strndup(str, strlen(str));
-       }
-
-char *BUF_strndup(const char *str, size_t siz)
-       {
-       char *ret;
-
-       if (str == NULL) return(NULL);
-
-       ret=OPENSSL_malloc(siz+1);
-       if (ret == NULL) 
-               {
-               BUFerr(BUF_F_BUF_STRNDUP,ERR_R_MALLOC_FAILURE);
-               return(NULL);
-               }
-       BUF_strlcpy(ret,str,siz+1);
-       return(ret);
-       }
-
-void *BUF_memdup(const void *data, size_t siz)
-       {
-       void *ret;
-
-       if (data == NULL) return(NULL);
-
-       ret=OPENSSL_malloc(siz);
-       if (ret == NULL) 
-               {
-               BUFerr(BUF_F_BUF_MEMDUP,ERR_R_MALLOC_FAILURE);
-               return(NULL);
-               }
-       return memcpy(ret, data, siz);
-       }       
-
-size_t BUF_strlcpy(char *dst, const char *src, size_t size)
-       {
-       size_t l = 0;
-       for(; size > 1 && *src; size--)
-               {
-               *dst++ = *src++;
-               l++;
-               }
-       if (size)
-               *dst = '\0';
-       return l + strlen(src);
-       }
-
-size_t BUF_strlcat(char *dst, const char *src, size_t size)
-       {
-       size_t l = 0;
-       for(; size > 0 && *dst; size--, dst++)
-               l++;
-       return l + BUF_strlcpy(dst, src, size);
-       }
-
 void BUF_reverse(unsigned char *out, unsigned char *in, size_t size)
        {
        size_t i;