heapster-saw/examples/linked_list.c
/* Insert an already-allocated list element into a sorted list */
Insert an already-allocated list element into a sorted list
Insert an already - allocated list element into a sorted list
list64_t *sorted_insert_no_malloc (list64_t *x, list64_t *l) {
  if (l == NULL) {
    x -> next = NULL;
    return x;
  } else if (x -> data <= l->data) {
    x -> next = l;
    return x;
  } else {
    l -> next = sorted_insert_no_malloc (x, l->next);
    return l;
  }
}
list64_t * sorted_insert_no_malloc ( list64_t * x , list64_t * l ) { if ( l == NULL ) { x -> next = NULL ; return x ; } else if ( x -> data <= l -> data ) { x -> next = l ; return x ; } else { l -> next = sorted_insert_no_malloc ( x , l -> next ) ; return l ; } }
Insert an already-allocated list element into a sorted list
Insert an already - allocated list element into a sorted list