treewide: Use struct fmt_spec by value instead of pointer in most cases.
[pspp] / src / ui / gui / psppire-data-store.c
index 2a3efe639522ea320a515914eeb3a734df4db6f6..c93a39fd40f7e390f03d1cf70339a18fcd9d6180 100644 (file)
@@ -57,7 +57,7 @@ static gboolean psppire_data_store_insert_case (PsppireDataStore *ds,
 static gboolean psppire_data_store_data_in (PsppireDataStore *ds,
                                            casenumber casenum, gint idx,
                                            struct substring input,
-                                           const struct fmt_spec *fmt);
+                                           struct fmt_spec);
 
 static GObjectClass *parent_class = NULL;
 
@@ -146,7 +146,7 @@ psppire_data_store_string_to_value (GtkTreeModel *model, gint col, gint row,
   const struct variable *variable = psppire_dict_get_variable (store->dict, col);
   g_return_val_if_fail (variable, FALSE);
 
-  const struct fmt_spec *fmt = var_get_print_format (variable);
+  struct fmt_spec fmt = var_get_print_format (variable);
 
   int width = var_get_width (variable);
 
@@ -164,7 +164,7 @@ psppire_data_store_string_to_value (GtkTreeModel *model, gint col, gint row,
   if (vp == NULL)
     {
       xx = data_in (ss_cstr (in), psppire_dict_encoding (store->dict),
-                   fmt->type, settings_get_fmt_settings (),
+                   fmt.type, settings_get_fmt_settings (),
                     &val, width, "UTF-8");
     }
 
@@ -184,7 +184,7 @@ unlabeled_value (PsppireDataStore *store, const struct variable *variable, const
       var_is_value_missing (variable, val) == MV_SYSTEM)
     return g_strdup ("");
 
-  const struct fmt_spec *fmt = var_get_print_format (variable);
+  struct fmt_spec fmt = var_get_print_format (variable);
   return value_to_text__ (*val, fmt, psppire_dict_encoding (store->dict));
 }
 
@@ -388,11 +388,11 @@ resize_datum (const union value *old, union value *new, const void *aux_)
   const struct resize_datum_aux *aux = aux_;
   int new_width = var_get_width (aux->new_variable);
   const char *enc = dict_get_encoding (aux->dict);
-  const struct fmt_spec *newfmt = var_get_print_format (aux->new_variable);
+  struct fmt_spec newfmt = var_get_print_format (aux->new_variable);
   char *s = data_out (old, enc, var_get_print_format (aux->old_variable),
                       settings_get_fmt_settings ());
-  enum fmt_type type = (fmt_usable_for_input (newfmt->type)
-                        ? newfmt->type
+  enum fmt_type type = (fmt_usable_for_input (newfmt.type)
+                        ? newfmt.type
                         : FMT_DOLLAR);
   free (data_in (ss_cstr (s), enc, type, settings_get_fmt_settings (),
                  new, new_width, enc));
@@ -819,7 +819,7 @@ psppire_data_store_set_value (PsppireDataStore *ds, casenumber casenum,
 /* Set the IDXth value of case C using D_IN */
 static gboolean
 psppire_data_store_data_in (PsppireDataStore *ds, casenumber casenum, gint idx,
-                           struct substring input, const struct fmt_spec *fmt)
+                           struct substring input, struct fmt_spec fmt)
 {
   union value value;
   int width;
@@ -840,7 +840,7 @@ psppire_data_store_data_in (PsppireDataStore *ds, casenumber casenum, gint idx,
                         FALSE);
   value_init (&value, width);
   ok = (datasheet_get_value (ds->datasheet, casenum, idx, &value)
-        && data_in_msg (input, UTF8, fmt->type, settings_get_fmt_settings (),
+        && data_in_msg (input, UTF8, fmt.type, settings_get_fmt_settings (),
                         &value, width, dict_get_encoding (dict->dict))
         && datasheet_put_value (ds->datasheet, casenum, idx, &value));
   value_destroy (&value, width);