Update code that assumed a dictionary's encoding could be NULL.
[pspp-builds.git] / src / data / sys-file-writer.c
index aeb97d64e30c31f685a740b27dc806789acd4377..5ebf3ede0b97d79cc9dbc65a01ed2fdbadbf130e 100644 (file)
@@ -851,22 +851,18 @@ static void
 write_encoding_record (struct sfm_writer *w,
                       const struct dictionary *d)
 {
-  if (dict_get_encoding (d) != NULL)
-    {
-      /* IANA says "...character set names may be up to 40 characters taken
-         from the printable characters of US-ASCII," so character set names
-         don't need to be recoded to be in UTF-8.
-
-         We convert encoding names to uppercase because SPSS writes encoding
-         names in uppercase. */
-      char *encoding = xstrdup (dict_get_encoding (d));
-      str_uppercase (encoding);
-      write_string_record (w, ss_cstr (encoding), 20);
-      free (encoding);
-    }
+  /* IANA says "...character set names may be up to 40 characters taken
+     from the printable characters of US-ASCII," so character set names
+     don't need to be recoded to be in UTF-8.
+
+     We convert encoding names to uppercase because SPSS writes encoding
+     names in uppercase. */
+  char *encoding = xstrdup (dict_get_encoding (d));
+  str_uppercase (encoding);
+  write_string_record (w, ss_cstr (encoding), 20);
+  free (encoding);
 }
 
-
 /* Writes the long variable name table. */
 static void
 write_longvar_table (struct sfm_writer *w, const struct dictionary *dict)