Sophie

Sophie

distrib > Fedora > 13 > i386 > media > os > by-pkgid > 4a989cf09a4b4c5f3273c280e92c6313 > files > 42

why-2.23-2.fc13.i686.rpm

#include "list.h"

/*@ requires \exists plist l; llist(c,l) && list_length(l) >= 2
  @ ensures \forall plist l; \forall list c1; \forall list c2;
  @   \old(llist(c, cons(c1,cons(c2,l)))) => 
  @     llist(\result, cons(c2,cons(c1,l)))
  @*/
list swap(list c) {
  list p;
  if (c != NULL) {
    p = c;
    c = c -> tl;
    p -> tl = c -> tl;
    c -> tl = p;
  }
  return c;
}