db: make escape_newlines() take a const pointer