Add *~ to .gitignore.
Make buffer::sync() const.