src/list.c
/*
 * Create a chain of linked nodes and fill in their data.
 */
Create a chain of linked nodes and fill in their data.
Create a chain of linked nodes and fill in their data .
static golle_list_node_t *make_linked_list (const void *item,
					    size_t size,
					    size_t num,
					    golle_list_node_t **out_tail)
{
  if (!item) {
    size = 0;
  }
  size_t node_size = size + sizeof (golle_list_node_t);
  golle_list_node_t
    *head = alloc_linked_nodes (node_size, num, out_tail);
  if (head && size) {
    golle_list_node_t *copy = head;
    while (copy) {
      copy->data = ((char *)copy) + sizeof (golle_list_node_t);
      memcpy (copy->data, item, size);
      copy = copy->next;
    }
  }
  return head;
}
static golle_list_node_t * make_linked_list ( const void * item , size_t size , size_t num , golle_list_node_t * * out_tail ) { if ( ! item ) { size = 0 ; } size_t node_size = size + sizeof ( golle_list_node_t ) ; golle_list_node_t * head = alloc_linked_nodes ( node_size , num , out_tail ) ; if ( head && size ) { golle_list_node_t * copy = head ; while ( copy ) { copy -> data = ( ( char * ) copy ) + sizeof ( golle_list_node_t ) ; memcpy ( copy -> data , item , size ) ; copy = copy -> next ; } } return head ; }
Create a chain of linked nodes and fill in their data.
Create a chain of linked nodes and fill in their data .
/* Get the head and tail of the new sublist. */ /* New copy of data into each node. */