We've had a mix of min, max from libpspp/misc.h and MIN, MAX from
[pspp-builds.git] / src / data / dictionary.c
index a7ba0274aec8280d9d2a71c86329d20cee8bb375..39001d89413f2a67b4972a70f156ad769171adf5 100644 (file)
@@ -38,6 +38,8 @@
 #include <libpspp/misc.h>
 #include <libpspp/str.h>
 
+#include "minmax.h"
+
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
 
@@ -287,14 +289,14 @@ dict_create_var (struct dictionary *d, const char *name, int width)
   mv_init (&v->miss, width);
   if (v->type == NUMERIC)
     {
-      v->print = f8_2;
+      v->print = fmt_for_output (FMT_F, 8, 2);
       v->alignment = ALIGN_RIGHT;
       v->display_width = 8;
       v->measure = MEASURE_SCALE;
     }
   else
     {
-      v->print = make_output_format (FMT_A, v->width, 0);
+      v->print = fmt_for_output (FMT_A, v->width, 0);
       v->alignment = ALIGN_LEFT;
       v->display_width = 8;
       v->measure = MEASURE_NOMINAL;
@@ -424,7 +426,7 @@ dict_contains_var (const struct dictionary *d, const struct variable *v)
 /* Compares two double pointers to variables, which should point
    to elements of a struct dictionary's `var' member array. */
 static int
-compare_var_ptrs (const void *a_, const void *b_, void *aux UNUSED) 
+compare_var_ptrs (const void *a_, const void *b_, const void *aux UNUSED) 
 {
   struct variable *const *a = a_;
   struct variable *const *b = b_;
@@ -435,8 +437,8 @@ compare_var_ptrs (const void *a_, const void *b_, void *aux UNUSED)
 /* Deletes variable V from dictionary D and frees V.
 
    This is a very bad idea if there might be any pointers to V
-   from outside D.  In general, no variable in default_dict
-   should be deleted when any transformations are active, because
+   from outside D.  In general, no variable in should be deleted when 
+   any transformations are active on the dictionary's dataset, because
    those transformations might reference the deleted variable.
    The safest time to delete a variable is just after a procedure
    has been executed, as done by MODIFY VARS.
@@ -532,8 +534,8 @@ dict_reorder_var (struct dictionary *d, struct variable *v,
 
   move_element (d->var, d->var_cnt, sizeof *d->var, v->index, new_index);
 
-  min_idx = min (v->index, new_index);
-  max_idx = max (v->index, new_index);
+  min_idx = MIN (v->index, new_index);
+  max_idx = MAX (v->index, new_index);
   for (i = min_idx; i <= max_idx; i++)
     d->var[i]->index = i;
 }
@@ -1164,14 +1166,14 @@ dict_clear_vectors (struct dictionary *d)
 
 /* Compares two strings. */
 static int
-compare_strings (const void *a, const void *b, void *aux UNUSED) 
+compare_strings (const void *a, const void *b, const void *aux UNUSED) 
 {
   return strcmp (a, b);
 }
 
 /* Hashes a string. */
 static unsigned
-hash_string (const void *s, void *aux UNUSED) 
+hash_string (const void *s, const void *aux UNUSED) 
 {
   return hsh_hash_string (s);
 }