src/coco.c
/**
 * @brief Creates a duplicate copy of string and returns a pointer to it.
 *
 * The caller is responsible for freeing the allocated memory using coco_free_memory().
 */
@brief Creates a duplicate copy of string and returns a pointer to it.
The caller is responsible for freeing the allocated memory using coco_free_memory().
@brief Creates a duplicate copy of string and returns a pointer to it . The caller is responsible for freeing the allocated memory using coco_free_memory () .
static char *coco_strdup(const char *string) {
  size_t len;
  char *duplicate;
  if (string == NULL)
    return NULL;
  len = strlen(string);
  duplicate = (char *) coco_allocate_memory(len + 1);
  memcpy(duplicate, string, len + 1);
  return duplicate;
}
static char * coco_strdup ( const char * string ) { size_t len ; char * duplicate ; if ( string == NULL ) return NULL ; len = strlen ( string ) ; duplicate = ( char * ) coco_allocate_memory ( len + 1 ) ; memcpy ( duplicate , string , len + 1 ) ; return duplicate ; }
@brief Creates a duplicate copy of string and returns a pointer to it.
@brief Creates a duplicate copy of string and returns a pointer to it .