1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
 herr_t
 ss_string_memset(ss_string_t *str,      /* The destination variable length string. */
                  const void *value,     /* The optional value to assign to STR. If NULL then a value of all zero bytes is
                                          * used. */
                  size_t nbytes          /* The number of bytes in VALUE. */
                  )
 {
     SS_ENTER(ss_string_memset, herr_t);
     void *value_here=NULL;

     if (NULL==value && NULL==(value=value_here=calloc(1, nbytes))) SS_ERROR(RESOURCE);
     if (ss_string_splice(str, value, 0, nbytes, str->nbytes)<0) SS_ERROR(FAILED);
     value_here = SS_FREE(value_here);

 SS_CLEANUP:
     SS_FREE(value_here);
     SS_LEAVE(0);
 }