buf.*: introduce the buf_filter() interface
dict.c: rewrite dict_clean_keys() for the new buffer interface