pspp-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pspp-cvs] pspp/src data/dictionary.c data/sys-file-reader...


From: John Darrington
Subject: [Pspp-cvs] pspp/src data/dictionary.c data/sys-file-reader...
Date: Sun, 29 Oct 2006 09:51:36 +0000

CVSROOT:        /sources/pspp
Module name:    pspp
Changes by:     John Darrington <jmd>   06/10/29 09:51:36

Modified files:
        src/data       : dictionary.c sys-file-reader.c value-labels.c 
                         variable.c variable.h 
        src/language/data-io: matrix-data.c 
        src/language/dictionary: modify-variables.c 
        src/language/stats: autorecode.c crosstabs.q descriptives.c 
                            frequencies.q 
        src/libpspp    : array.c array.h hash.c hash.h 
        src/math       : sort.c 

Log message:
        Made array.h const correct, and dealt with the consequences.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/dictionary.c?cvsroot=pspp&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/sys-file-reader.c?cvsroot=pspp&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/value-labels.c?cvsroot=pspp&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/variable.c?cvsroot=pspp&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/variable.h?cvsroot=pspp&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/data-io/matrix-data.c?cvsroot=pspp&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/dictionary/modify-variables.c?cvsroot=pspp&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/stats/autorecode.c?cvsroot=pspp&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/stats/crosstabs.q?cvsroot=pspp&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/stats/descriptives.c?cvsroot=pspp&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/stats/frequencies.q?cvsroot=pspp&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/pspp/src/libpspp/array.c?cvsroot=pspp&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/pspp/src/libpspp/array.h?cvsroot=pspp&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/pspp/src/libpspp/hash.c?cvsroot=pspp&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/pspp/src/libpspp/hash.h?cvsroot=pspp&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/pspp/src/math/sort.c?cvsroot=pspp&r1=1.15&r2=1.16

Patches:
Index: data/dictionary.c
===================================================================
RCS file: /sources/pspp/pspp/src/data/dictionary.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- data/dictionary.c   26 Oct 2006 06:16:36 -0000      1.16
+++ data/dictionary.c   29 Oct 2006 09:51:35 -0000      1.17
@@ -424,7 +424,7 @@
 /* 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_;
@@ -1164,14 +1164,14 @@
 
 /* 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);
 }

Index: data/sys-file-reader.c
===================================================================
RCS file: /sources/pspp/pspp/src/data/sys-file-reader.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- data/sys-file-reader.c      27 Sep 2006 10:21:35 -0000      1.23
+++ data/sys-file-reader.c      29 Oct 2006 09:51:36 -0000      1.24
@@ -215,7 +215,7 @@
 };
 
 static int
-pair_sn_compare(const void *_p1, const void *_p2, void *aux UNUSED)
+pair_sn_compare(const void *_p1, const void *_p2, const void *aux UNUSED)
 {
   int i;
 
@@ -246,7 +246,7 @@
 }
 
 static unsigned int
-pair_sn_hash(const void *_p, void *aux UNUSED)
+pair_sn_hash(const void *_p, const void *aux UNUSED)
 {
   int i;
   const struct name_pair *p = _p;
@@ -264,7 +264,7 @@
 }
 
 static void
-pair_sn_free(void *p, void *aux UNUSED)
+pair_sn_free(void *p, const void *aux UNUSED)
 {
   free(p);
 }

Index: data/value-labels.c
===================================================================
RCS file: /sources/pspp/pspp/src/data/value-labels.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- data/value-labels.c 14 Oct 2006 00:25:20 -0000      1.7
+++ data/value-labels.c 29 Oct 2006 09:51:36 -0000      1.8
@@ -395,7 +395,7 @@
 
 /* Compares two value labels and returns a strcmp()-type result. */
 int
-compare_int_val_lab (const void *a_, const void *b_, void *vls_)
+compare_int_val_lab (const void *a_, const void *b_, const void *vls_)
 {
   const struct int_val_lab *a = a_;
   const struct int_val_lab *b = b_;
@@ -409,7 +409,7 @@
 
 /* Hash a value label. */
 unsigned
-hash_int_val_lab (const void *vl_, void *vls_)
+hash_int_val_lab (const void *vl_, const void *vls_)
 {
   const struct int_val_lab *vl = vl_;
   const struct val_labs *vls = vls_;
@@ -422,7 +422,7 @@
 
 /* Free a value label. */
 void
-free_int_val_lab (void *vl_, void *vls_ UNUSED) 
+free_int_val_lab (void *vl_, const void *vls_ UNUSED) 
 {
   struct int_val_lab *vl = vl_;
 
@@ -500,7 +500,7 @@
 
 /* A hsh_compare_func that compares A and B. */
 static int
-compare_atoms (const void *a_, const void *b_, void *aux UNUSED) 
+compare_atoms (const void *a_, const void *b_, const void *aux UNUSED) 
 {
   const struct atom *a = a_;
   const struct atom *b = b_;
@@ -510,7 +510,7 @@
 
 /* A hsh_hash_func that hashes ATOM. */
 static unsigned
-hash_atom (const void *atom_, void *aux UNUSED) 
+hash_atom (const void *atom_, const void *aux UNUSED) 
 {
   const struct atom *atom = atom_;
 
@@ -519,7 +519,7 @@
 
 /* A hsh_free_func that destroys ATOM. */
 static void
-free_atom (void *atom_, void *aux UNUSED) 
+free_atom (void *atom_, const void *aux UNUSED) 
 {
   struct atom *atom = atom_;
 

Index: data/variable.c
===================================================================
RCS file: /sources/pspp/pspp/src/data/variable.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- data/variable.c     21 Sep 2006 14:01:09 -0000      1.10
+++ data/variable.c     29 Oct 2006 09:51:36 -0000      1.11
@@ -216,7 +216,7 @@
 /* A hsh_compare_func that orders variables A and B by their
    names. */
 int
-compare_var_names (const void *a_, const void *b_, void *foo UNUSED) 
+compare_var_names (const void *a_, const void *b_, const void *aux UNUSED) 
 {
   const struct variable *a = a_;
   const struct variable *b = b_;
@@ -226,7 +226,7 @@
 
 /* A hsh_hash_func that hashes variable V based on its name. */
 unsigned
-hash_var_name (const void *v_, void *foo UNUSED) 
+hash_var_name (const void *v_, const void *aux UNUSED) 
 {
   const struct variable *v = v_;
 
@@ -236,7 +236,7 @@
 /* A hsh_compare_func that orders pointers to variables A and B
    by their names. */
 int
-compare_var_ptr_names (const void *a_, const void *b_, void *foo UNUSED) 
+compare_var_ptr_names (const void *a_, const void *b_, const void *aux UNUSED) 
 {
   struct variable *const *a = a_;
   struct variable *const *b = b_;
@@ -247,7 +247,7 @@
 /* A hsh_hash_func that hashes pointer to variable V based on its
    name. */
 unsigned
-hash_var_ptr_name (const void *v_, void *foo UNUSED) 
+hash_var_ptr_name (const void *v_, const void *aux UNUSED) 
 {
   struct variable *const *v = v_;
 

Index: data/variable.h
===================================================================
RCS file: /sources/pspp/pspp/src/data/variable.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- data/variable.h     27 Jun 2006 19:09:21 -0000      1.12
+++ data/variable.h     29 Oct 2006 09:51:36 -0000      1.13
@@ -87,8 +87,8 @@
 /* Variable names. */
 bool var_is_valid_name (const char *, bool issue_error);
 bool var_is_plausible_name (const char *name, bool issue_error);
-int compare_var_names (const void *, const void *, void *);
-unsigned hash_var_name (const void *, void *);
+int  compare_var_names (const void *, const void *, const void *);
+unsigned hash_var_name (const void *, const void *);
 
 /* Short names. */
 void var_set_short_name (struct variable *, const char *);
@@ -96,8 +96,8 @@
 void var_clear_short_name (struct variable *);
 
 /* Pointers to `struct variable', by name. */
-int compare_var_ptr_names (const void *, const void *, void *);
-unsigned hash_var_ptr_name (const void *, void *);
+int compare_var_ptr_names (const void *, const void *, const void *);
+unsigned hash_var_ptr_name (const void *, const void *);
 
 /* Variable auxiliary data. */
 void *var_attach_aux (struct variable *,

Index: language/data-io/matrix-data.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/data-io/matrix-data.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- language/data-io/matrix-data.c      26 Oct 2006 06:16:36 -0000      1.14
+++ language/data-io/matrix-data.c      29 Oct 2006 09:51:36 -0000      1.15
@@ -1584,7 +1584,7 @@
 
 /* Compares doubles A and B, treating SYSMIS as greatest. */
 static int
-compare_doubles (const void *a_, const void *b_, void *aux UNUSED)
+compare_doubles (const void *a_, const void *b_, const void *aux UNUSED)
 {
   const double *a = a_;
   const double *b = b_;
@@ -1604,9 +1604,9 @@
 /* Return strcmp()-type comparison of the MX->n_factors factors at _A and
    _B.  Sort missing values toward the end. */
 static int
-compare_factors (const void *a_, const void *b_, void *mx_)
+compare_factors (const void *a_, const void *b_, const void *mx_)
 {
-  struct matrix_data_pgm *mx = mx_;
+  const struct matrix_data_pgm *mx = mx_;
   struct factor_data *const *pa = a_;
   struct factor_data *const *pb = b_;
   const double *a = (*pa)->factors;

Index: language/dictionary/modify-variables.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/dictionary/modify-variables.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- language/dictionary/modify-variables.c      26 Oct 2006 06:16:36 -0000      
1.10
+++ language/dictionary/modify-variables.c      29 Oct 2006 09:51:36 -0000      
1.11
@@ -54,7 +54,7 @@
 static struct ordering forward_positional_ordering = {1, 1};
 
 static int compare_variables_given_ordering (const void *, const void *,
-                                             void *ordering);
+                                             const void *ordering);
 
 /* Explains how to modify the variables in a dictionary. */
 struct var_modification
@@ -343,7 +343,7 @@
    ORDERING, returning a strcmp()-type result. */
 static int
 compare_variables_given_ordering (const void *a_, const void *b_,
-                                  void *ordering_)
+                                  const void *ordering_)
 {
   struct variable *const *pa = a_;
   struct variable *const *pb = b_;
@@ -372,7 +372,7 @@
    var_renaming structures A and B. */
 static int
 compare_var_renaming_by_new_name (const void *a_, const void *b_,
-                                  void *foo UNUSED) 
+                                  const void *aux UNUSED) 
 {
   const struct var_renaming *a = a_;
   const struct var_renaming *b = b_;

Index: language/stats/autorecode.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/stats/autorecode.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- language/stats/autorecode.c 26 Oct 2006 06:16:36 -0000      1.12
+++ language/stats/autorecode.c 29 Oct 2006 09:51:36 -0000      1.13
@@ -311,7 +311,7 @@
 /* AUTORECODE procedure. */
 
 static int
-compare_alpha_value (const void *a_, const void *b_, void *v_)
+compare_alpha_value (const void *a_, const void *b_, const void *v_)
 {
   const union arc_value *a = a_;
   const union arc_value *b = b_;
@@ -321,7 +321,7 @@
 }
 
 static unsigned
-hash_alpha_value (const void *a_, void *v_)
+hash_alpha_value (const void *a_, const void *v_)
 {
   const union arc_value *a = a_;
   const struct variable *v = v_;
@@ -330,7 +330,7 @@
 }
 
 static int
-compare_numeric_value (const void *a_, const void *b_, void *foo UNUSED)
+compare_numeric_value (const void *a_, const void *b_, const void *aux UNUSED)
 {
   const union arc_value *a = a_;
   const union arc_value *b = b_;
@@ -339,7 +339,7 @@
 }
 
 static unsigned
-hash_numeric_value (const void *a_, void *foo UNUSED)
+hash_numeric_value (const void *a_, const void *aux UNUSED)
 {
   const union arc_value *a = a_;
 

Index: language/stats/crosstabs.q
===================================================================
RCS file: /sources/pspp/pspp/src/language/stats/crosstabs.q,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- language/stats/crosstabs.q  26 Oct 2006 06:16:36 -0000      1.18
+++ language/stats/crosstabs.q  29 Oct 2006 09:51:36 -0000      1.19
@@ -483,8 +483,8 @@
 
 /* Data file processing. */
 
-static int compare_table_entry (const void *, const void *, void *);
-static unsigned hash_table_entry (const void *, void *);
+static int compare_table_entry (const void *, const void *, const void *);
+static unsigned hash_table_entry (const void *, const void *);
 
 /* Set up the crosstabulation tables for processing. */
 static  void
@@ -697,7 +697,7 @@
 /* Compare the table_entry's at A and B and return a strcmp()-type
    result. */
 static int 
-compare_table_entry (const void *a_, const void *b_, void *foo UNUSED)
+compare_table_entry (const void *a_, const void *b_, const void *aux UNUSED)
 {
   const struct table_entry *a = a_;
   const struct table_entry *b = b_;
@@ -737,7 +737,7 @@
 
 /* Calculate a hash value from table_entry A. */
 static unsigned
-hash_table_entry (const void *a_, void *foo UNUSED)
+hash_table_entry (const void *a_, const void *aux UNUSED)
 {
   const struct table_entry *a = a_;
   unsigned long hash;
@@ -1610,7 +1610,7 @@
    result.  WIDTH_ points to an int which is either 0 for a
    numeric value or a string width for a string value. */
 static int
-compare_value (const void *a_, const void *b_, void *width_)
+compare_value (const void *a_, const void *b_, const void *width_)
 {
   const union value *a = a_;
   const union value *b = b_;

Index: language/stats/descriptives.c
===================================================================
RCS file: /sources/pspp/pspp/src/language/stats/descriptives.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- language/stats/descriptives.c       26 Oct 2006 06:16:36 -0000      1.14
+++ language/stats/descriptives.c       29 Oct 2006 09:51:36 -0000      1.15
@@ -939,11 +939,11 @@
 /* Compares `struct dsc_var's A and B according to the ordering
    specified by CMD. */
 static int
-descriptives_compare_dsc_vars (const void *a_, const void *b_, void *dsc_)
+descriptives_compare_dsc_vars (const void *a_, const void *b_, const void 
*dsc_)
 {
   const struct dsc_var *a = a_;
   const struct dsc_var *b = b_;
-  struct dsc_proc *dsc = dsc_;
+  const struct dsc_proc *dsc = dsc_;
 
   int result;
 

Index: language/stats/frequencies.q
===================================================================
RCS file: /sources/pspp/pspp/src/language/stats/frequencies.q,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- language/stats/frequencies.q        26 Oct 2006 06:16:36 -0000      1.19
+++ language/stats/frequencies.q        29 Oct 2006 09:51:36 -0000      1.20
@@ -267,7 +267,7 @@
   };
 
 static inline struct var_freqs *
-get_var_freqs (struct variable *v)
+get_var_freqs (const struct variable *v)
 {
   assert (v != NULL);
   assert (v->aux != NULL);
@@ -515,7 +515,7 @@
 
   for (i = 0; i < n_variables; i++)
     {
-      struct variable *v = v_variables[i];
+      const struct variable *v = v_variables[i];
       const union value *val = case_data (c, v->fv);
       struct var_freqs *vf = get_var_freqs (v);
       struct freq_tab *ft = &vf->tab;
@@ -997,7 +997,7 @@
 
 /* Hash of numeric values. */
 static unsigned
-hash_value_numeric (const void *value_, void *foo UNUSED)
+hash_value_numeric (const void *value_, const void *aux UNUSED)
 {
   const struct freq *value = value_;
   return hsh_hash_double (value->v[0].f);
@@ -1005,10 +1005,10 @@
 
 /* Hash of string values. */
 static unsigned
-hash_value_alpha (const void *value_, void *v_)
+hash_value_alpha (const void *value_, const void *v_)
 {
   const struct freq *value = value_;
-  struct variable *v = v_;
+  const struct variable *v = v_;
   struct var_freqs *vf = get_var_freqs (v);
 
   return hsh_hash_bytes (value->v[0].s, vf->width);
@@ -1016,7 +1016,7 @@
 
 /* Ascending numeric compare of values. */
 static int
-compare_value_numeric_a (const void *a_, const void *b_, void *foo UNUSED)
+compare_value_numeric_a (const void *a_, const void *b_, const void *aux 
UNUSED)
 {
   const struct freq *a = a_;
   const struct freq *b = b_;
@@ -1031,11 +1031,11 @@
 
 /* Ascending string compare of values. */
 static int
-compare_value_alpha_a (const void *a_, const void *b_, void *v_)
+compare_value_alpha_a (const void *a_, const void *b_, const void *v_)
 {
   const struct freq *a = a_;
   const struct freq *b = b_;
-  struct variable *v = v_;
+  const struct variable *v = v_;
   struct var_freqs *vf = get_var_freqs (v);
 
   return memcmp (a->v[0].s, b->v[0].s, vf->width);
@@ -1043,14 +1043,14 @@
 
 /* Descending numeric compare of values. */
 static int
-compare_value_numeric_d (const void *a, const void *b, void *foo UNUSED)
+compare_value_numeric_d (const void *a, const void *b, const void *aux UNUSED)
 {
-  return -compare_value_numeric_a (a, b, foo);
+  return -compare_value_numeric_a (a, b, aux);
 }
 
 /* Descending string compare of values. */
 static int
-compare_value_alpha_d (const void *a, const void *b, void *v)
+compare_value_alpha_d (const void *a, const void *b, const void *v)
 {
   return -compare_value_alpha_a (a, b, v);
 }
@@ -1058,7 +1058,7 @@
 /* Ascending numeric compare of frequency;
    secondary key on ascending numeric value. */
 static int
-compare_freq_numeric_a (const void *a_, const void *b_, void *foo UNUSED)
+compare_freq_numeric_a (const void *a_, const void *b_, const void *aux UNUSED)
 {
   const struct freq *a = a_;
   const struct freq *b = b_;
@@ -1079,11 +1079,11 @@
 /* Ascending numeric compare of frequency;
    secondary key on ascending string value. */
 static int
-compare_freq_alpha_a (const void *a_, const void *b_, void *v_)
+compare_freq_alpha_a (const void *a_, const void *b_, const void *v_)
 {
   const struct freq *a = a_;
   const struct freq *b = b_;
-  struct variable *v = v_;
+  const struct variable *v = v_;
   struct var_freqs *vf = get_var_freqs (v);
 
   if (a->c > b->c)
@@ -1097,7 +1097,7 @@
 /* Descending numeric compare of frequency;
    secondary key on ascending numeric value. */
 static int
-compare_freq_numeric_d (const void *a_, const void *b_, void *foo UNUSED)
+compare_freq_numeric_d (const void *a_, const void *b_, const void *aux UNUSED)
 {
   const struct freq *a = a_;
   const struct freq *b = b_;
@@ -1118,11 +1118,11 @@
 /* Descending numeric compare of frequency;
    secondary key on ascending string value. */
 static int
-compare_freq_alpha_d (const void *a_, const void *b_, void *v_)
+compare_freq_alpha_d (const void *a_, const void *b_, const void *v_)
 {
   const struct freq *a = a_;
   const struct freq *b = b_;
-  struct variable *v = v_;
+  const struct variable *v = v_;
   struct var_freqs *vf = get_var_freqs (v);
 
   if (a->c > b->c)

Index: libpspp/array.c
===================================================================
RCS file: /sources/pspp/pspp/src/libpspp/array.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- libpspp/array.c     14 Oct 2006 00:25:21 -0000      1.5
+++ libpspp/array.c     29 Oct 2006 09:51:36 -0000      1.6
@@ -590,7 +590,7 @@
 
 void
 sort (void *array, size_t count, size_t size,
-      algo_compare_func *compare, void *aux)
+           algo_compare_func *compare, const void *aux)
 {
   char *const first = array;
   const size_t max_thresh = MAX_THRESH * size;
@@ -755,7 +755,7 @@
    passed to COMPARE as auxiliary data. */
 bool
 is_sorted (const void *array, size_t count, size_t size,
-           algo_compare_func *compare, void *aux) 
+           algo_compare_func *compare, const void *aux) 
 {
   const char *first = array;
   size_t idx;

Index: libpspp/array.h
===================================================================
RCS file: /sources/pspp/pspp/src/libpspp/array.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- libpspp/array.h     14 Oct 2006 00:25:21 -0000      1.4
+++ libpspp/array.h     29 Oct 2006 09:51:36 -0000      1.5
@@ -6,7 +6,8 @@
 
 /* Compares A and B, given auxiliary data AUX, and returns a
    strcmp()-type result. */
-typedef int algo_compare_func (const void *a, const void *b, void *aux);
+
+typedef int algo_compare_func (const void *a, const void *b, const void *aux);
 
 /* Tests a predicate on DATA, given auxiliary data AUX */
 typedef bool algo_predicate_func (const void *data, void *aux);
@@ -46,13 +47,13 @@
    using COMPARE for comparisons.  AUX is passed to each
    comparison as auxiliary data. */
 void sort (void *array, size_t count, size_t size,
-           algo_compare_func *compare, void *aux);
+           algo_compare_func *compare, const void *aux);
 
 /* Tests whether ARRAY, which contains COUNT elements of SIZE
    bytes each, is sorted in order according to COMPARE.  AUX is
    passed to COMPARE as auxiliary data. */
 bool is_sorted (const void *array, size_t count, size_t size,
-               algo_compare_func *compare, void *aux);
+               algo_compare_func *compare, const void *aux);
 
 /* Makes the elements in ARRAY unique, by moving up duplicates,
    and returns the new number of elements in the array.  Sorted

Index: libpspp/hash.c
===================================================================
RCS file: /sources/pspp/pspp/src/libpspp/hash.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- libpspp/hash.c      15 Oct 2006 01:51:02 -0000      1.7
+++ libpspp/hash.c      29 Oct 2006 09:51:36 -0000      1.8
@@ -151,7 +151,7 @@
     size_t size;                /* Number of entries (a power of 2). */
     void **entries;            /* Hash table proper. */
 
-    void *aux;                  /* Auxiliary data for comparison functions. */
+    const void *aux;            /* Auxiliary data for comparison functions. */
     hsh_compare_func *compare;
     hsh_hash_func *hash;
     hsh_free_func *free;
@@ -365,11 +365,11 @@
 /* Dereferences void ** pointers and passes them to the hash
    comparison function. */
 static int
-comparison_helper (const void *a_, const void *b_, void *h_) 
+comparison_helper (const void *a_, const void *b_, const void *h_) 
 {
   void *const *a = a_;
   void *const *b = b_;
-  struct hsh_table *h = h_;
+  const struct hsh_table *h = h_;
 
   assert(a);
   assert(b);

Index: libpspp/hash.h
===================================================================
RCS file: /sources/pspp/pspp/src/libpspp/hash.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- libpspp/hash.h      15 Oct 2006 01:51:02 -0000      1.4
+++ libpspp/hash.h      29 Oct 2006 09:51:36 -0000      1.5
@@ -23,9 +23,9 @@
 #include <stddef.h>
 #include <stdbool.h>
 
-typedef int hsh_compare_func (const void *, const void *, void *aux);
-typedef unsigned hsh_hash_func (const void *, void *aux);
-typedef void hsh_free_func (void *, void *aux);
+typedef int hsh_compare_func (const void *, const void *, const void *aux);
+typedef unsigned hsh_hash_func (const void *, const void *aux);
+typedef void hsh_free_func (void *, const void *aux);
 
 /* Hash table iterator (opaque). */
 struct hsh_iterator

Index: math/sort.c
===================================================================
RCS file: /sources/pspp/pspp/src/math/sort.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- math/sort.c 26 Oct 2006 06:16:36 -0000      1.15
+++ math/sort.c 29 Oct 2006 09:51:36 -0000      1.16
@@ -139,7 +139,7 @@
     unsigned long idx;  /* Index to allow for stable sorting. */
   };
 
-static int compare_indexed_cases (const void *, const void *, void *);
+static int compare_indexed_cases (const void *, const void *, const void *);
 
 /* If the data is in memory, do an internal sort and return a new
    casefile for the data.  Otherwise, return a null pointer. */
@@ -200,9 +200,9 @@
    at A and B, with a "last resort" comparison for stability, and
    returns a strcmp()-type result. */
 static int
-compare_indexed_cases (const void *a_, const void *b_, void *criteria_)
+compare_indexed_cases (const void *a_, const void *b_, const void *criteria_)
 {
-  struct sort_criteria *criteria = criteria_;
+  const struct sort_criteria *criteria = criteria_;
   const struct indexed_case *a = a_;
   const struct indexed_case *b = b_;
   int result = compare_record (&a->c, &b->c, criteria);
@@ -309,16 +309,17 @@
   };
 
 static bool destroy_initial_run_state (struct initial_run_state *);
-static void process_case (struct initial_run_state *, const struct ccase *,
-                          size_t);
+static void process_case (struct initial_run_state *, 
+                         const struct ccase *, size_t);
 static int allocate_cases (struct initial_run_state *);
 static void output_record (struct initial_run_state *);
 static void start_run (struct initial_run_state *);
 static void end_run (struct initial_run_state *);
 static int compare_record_run (const struct record_run *,
                                const struct record_run *,
-                               struct initial_run_state *);
-static int compare_record_run_minheap (const void *, const void *, void *);
+                               const struct initial_run_state *);
+static int compare_record_run_minheap (const void *, const void *, 
+                                      const void *);
 
 /* Reads cases from READER and composes initial runs in XSRT. */
 static int
@@ -361,7 +362,8 @@
 
 /* Add a single case to an initial run. */
 static void
-process_case (struct initial_run_state *irs, const struct ccase *c, size_t idx)
+process_case (struct initial_run_state *irs, const struct ccase *c, 
+             size_t idx)
 {
   struct record_run *rr;
 
@@ -480,7 +482,7 @@
 static int
 compare_record_run (const struct record_run *a,
                     const struct record_run *b,
-                    struct initial_run_state *irs)
+                    const struct initial_run_state *irs)
 {
   int result = a->run < b->run ? -1 : a->run > b->run;
   if (result == 0)
@@ -494,7 +496,7 @@
    on the current record according to SCP, but in descending
    order. */
 static int
-compare_record_run_minheap (const void *a, const void *b, void *irs) 
+compare_record_run_minheap (const void *a, const void *b, const void *irs) 
 {
   return -compare_record_run (a, b, irs);
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]