allowing creation of zero length strings
authorVolker Birk <vb@pep.foundation>
Wed, 24 Jan 2018 11:11:20 +0100
changeset 24403c45fce3ef40
parent 2437 97d602cc813b
child 2442 c8448057b91d
allowing creation of zero length strings
src/pEp_string.c
src/pEp_string.h
     1.1 --- a/src/pEp_string.c	Tue Jan 23 20:53:17 2018 +0100
     1.2 +++ b/src/pEp_string.c	Wed Jan 24 11:11:20 2018 +0100
     1.3 @@ -8,10 +8,6 @@
     1.4  
     1.5  DYNAMIC_API char * new_string(const char *src, size_t len)
     1.6  {
     1.7 -    assert(src || len);
     1.8 -    if (!(src || len))
     1.9 -        return NULL;
    1.10 -
    1.11      char *s = NULL;
    1.12      if (src) {
    1.13          if (len)
     2.1 --- a/src/pEp_string.h	Tue Jan 23 20:53:17 2018 +0100
     2.2 +++ b/src/pEp_string.h	Wed Jan 24 11:11:20 2018 +0100
     2.3 @@ -20,12 +20,9 @@
     2.4  //  return value:
     2.5  //      pointer to string object or NULL if out of memory
     2.6  //
     2.7 -//  caveat:
     2.8 -//      one of the two parameters has to be set at least
     2.9 -//
    2.10  //  calling with str and len is equivalent to strndup()
    2.11  //  calling with str but len=0 is equivalent to strdup()
    2.12 -//  calling with str=NULL and len is equivalent to calloc()
    2.13 +//  calling with str=NULL is equivalent to calloc()
    2.14  
    2.15  DYNAMIC_API char * new_string(const char *src, size_t len);
    2.16