[SNSF] Replaced most uses of fill/copy with fill_n/copy_n, and a few other minor code cleanups.