void swap_pairwise(struct node **head) { struct node *i=*head,*j,*tmp; while(i != NULL && i->next != NULL) { j = i->next; node_swap(&i,&j); i = i->next->next; } return; }
/* * * @return the node inserted, no need to free the node afterwards * */ Node *import_node (import_state_t * is, int level, Node *node) { int node_level; level += is->startlevel; while ((node_level = nodes_left (is->npos)) > level) is->npos = node_left (is->npos); if (node_level == level) is->npos = node_insert_down (is->npos); if (node_level < level) is->npos = node_insert_right (is->npos); node_swap (node, is->npos); node_free (is->npos); is->npos = node; return is->npos; }