Simplify edit.c functions replace_{push,pop}.

* Replace xmalloc (+memmove) with xrealloc
* Code style adjustments.
* Remove obsolete TODO comment
Merge #733 'Simplify edit.c functions replace_{push,pop}.'