From: Ben Pfaff Date: Sat, 18 Jun 2011 05:16:44 +0000 (-0700) Subject: sys-file-writer: Omit empty multiple response sets records. X-Git-Tag: v0.7.9~276 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aafd3d71437306a0b89909dbc697b6241f5d2e7f;p=pspp-builds.git sys-file-writer: Omit empty multiple response sets records. Multiple response sets are divided into two records in a .sav file: one record with subtype 7 and one with subtype 19. PSPP was incorrectly writing both records even if one of them was empty. This commit makes it omit the empty record. Thanks to Curt Reinhold for providing the .sav file that led to this discovery. --- diff --git a/src/data/sys-file-writer.c b/src/data/sys-file-writer.c index 6c9d4617..63e14ffb 100644 --- a/src/data/sys-file-writer.c +++ b/src/data/sys-file-writer.c @@ -707,7 +707,8 @@ write_mrsets (struct sfm_writer *w, const struct dictionary *dict, ds_put_byte (&s, '\n'); } - write_string_record (w, ds_ss (&s), pre_v14 ? 7 : 19); + if (!ds_is_empty (&s)) + write_string_record (w, ds_ss (&s), pre_v14 ? 7 : 19); ds_destroy (&s); }