replace copy_spaces and copy_chars functions with equivalent memset.