treewide: Use struct fmt_spec by value instead of pointer in most cases.
[pspp] / src / ui / gui / psppire-dict.c
index 215a1d3e5811cbe02a3c94589fb8d81d5cec178a..5ba4246ac78417f769206cfc5fc5862351d30c26 100644 (file)
@@ -454,7 +454,7 @@ psppire_dict_set_name (PsppireDict* d, gint idx, const gchar *name)
   g_assert (d);
   g_assert (PSPPIRE_IS_DICT (d));
 
-  if (! dict_id_is_valid (d->dict, name, false))
+  if (! dict_id_is_valid (d->dict, name))
     return FALSE;
 
   if (idx < dict_get_n_vars (d->dict))
@@ -550,26 +550,15 @@ psppire_dict_clear (PsppireDict *d)
 
 /* Return true if NAME would be a valid name of a variable to add to the
    dictionary.  False otherwise.
-   If REPORT is true, then invalid names will be reported as such as errors
 */
 gboolean
 psppire_dict_check_name (const PsppireDict *dict,
-                        const gchar *name, gboolean report)
+                        const gchar *name)
 {
-  if (! dict_id_is_valid (dict->dict, name, report))
-    return FALSE;
-
-  if (psppire_dict_lookup_var (dict, name))
-    {
-      if (report)
-       msg (ME, _("Duplicate variable name."));
-      return FALSE;
-    }
-
-  return TRUE;
+  return (dict_id_is_valid (dict->dict, name)
+          && !psppire_dict_lookup_var (dict, name));
 }
 
-
 gint
 psppire_dict_get_next_value_idx (const PsppireDict *dict)
 {
@@ -781,7 +770,7 @@ tree_model_get_path (GtkTreeModel *model, GtkTreeIter *iter)
   return path;
 }
 
-const struct fmt_spec *var_get_write_format (const struct variable *);
+struct fmt_spec var_get_write_format (const struct variable *);
 
 static void
 tree_model_get_value (GtkTreeModel *model, GtkTreeIter *iter,
@@ -794,7 +783,7 @@ tree_model_get_value (GtkTreeModel *model, GtkTreeIter *iter,
 
   var = iter->user_data;
 
-  const struct fmt_spec *fs = var_get_write_format (var);
+  struct fmt_spec fs = var_get_write_format (var);
 
   switch (column)
     {
@@ -804,11 +793,11 @@ tree_model_get_value (GtkTreeModel *model, GtkTreeIter *iter,
       break;
     case DICT_TVM_COL_WIDTH:
       g_value_init (value, G_TYPE_INT);
-      g_value_set_int (value, fs->w);
+      g_value_set_int (value, fs.w);
       break;
     case DICT_TVM_COL_DECIMAL:
       g_value_init (value, G_TYPE_INT);
-      g_value_set_int (value, fs->d);
+      g_value_set_int (value, fs.d);
       break;
     case DICT_TVM_COL_LABEL:
       g_value_init (value, G_TYPE_STRING);
@@ -891,7 +880,7 @@ gboolean
 psppire_dict_rename_var (PsppireDict *dict, struct variable *v,
                         const gchar *name)
 {
-  if (! dict_id_is_valid (dict->dict, name, false))
+  if (! dict_id_is_valid (dict->dict, name))
     return FALSE;
 
   /* Make sure no other variable has this name */