simplify write_list_vars()
This series of commits simplifies write_list_vars() and gets rid of the now unused set_ref_allow() and write_pair() functions.
If you want to understand the changes, looking at the individual commits (= baby steps) might help ;-) (OTOH, looking at the summarized diff shows how much superfluous things were there.)
The behaviour of write_list_vars() stays unchanged, with the exception that the variable content gets sorted (in var_transform()) to have a reproducible output.
Also, some test variables get added to cleanprof.in and cleanprof.out.