pspp-cvs
[Top][All Lists]
Advanced

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

[Pspp-cvs] pspp/src data/sys-file-writer.c language/stats/...


From: John Darrington
Subject: [Pspp-cvs] pspp/src data/sys-file-writer.c language/stats/...
Date: Sun, 29 Oct 2006 11:16:07 +0000

CVSROOT:        /sources/pspp
Module name:    pspp
Changes by:     John Darrington <jmd>   06/10/29 11:16:07

Modified files:
        src/data       : sys-file-writer.c 
        src/language/stats: frequencies.q 
        src/libpspp    : array.c array.h hash.c hash.h 

Log message:
        More constness

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/data/sys-file-writer.c?cvsroot=pspp&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/pspp/src/language/stats/frequencies.q?cvsroot=pspp&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/pspp/src/libpspp/array.c?cvsroot=pspp&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/pspp/src/libpspp/array.h?cvsroot=pspp&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/pspp/src/libpspp/hash.c?cvsroot=pspp&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pspp/src/libpspp/hash.h?cvsroot=pspp&r1=1.5&r2=1.6

Patches:
Index: data/sys-file-writer.c
===================================================================
RCS file: /sources/pspp/pspp/src/data/sys-file-writer.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- data/sys-file-writer.c      27 Sep 2006 10:21:35 -0000      1.13
+++ data/sys-file-writer.c      29 Oct 2006 11:16:07 -0000      1.14
@@ -372,7 +372,7 @@
 
   if (dict_get_weight (d) != NULL)
     {
-      struct variable *weight_var;
+      const struct variable *weight_var;
       int recalc_weight_idx = 1;
       int i;
 

Index: language/stats/frequencies.q
===================================================================
RCS file: /sources/pspp/pspp/src/language/stats/frequencies.q,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- language/stats/frequencies.q        29 Oct 2006 09:51:36 -0000      1.20
+++ language/stats/frequencies.q        29 Oct 2006 11:16:07 -0000      1.21
@@ -717,10 +717,10 @@
 /* Returns true iff the value in struct freq F is non-missing
    for variable V. */
 static bool
-not_missing (const void *f_, void *v_) 
+not_missing (const void *f_, const void *v_) 
 {
   const struct freq *f = f_;
-  struct variable *v = v_;
+  const struct variable *v = v_;
 
   return !mv_is_value_missing (&v->miss, f->v);
 }

Index: libpspp/array.c
===================================================================
RCS file: /sources/pspp/pspp/src/libpspp/array.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- libpspp/array.c     29 Oct 2006 09:51:36 -0000      1.6
+++ libpspp/array.c     29 Oct 2006 11:16:07 -0000      1.7
@@ -108,7 +108,7 @@
 void *
 find (const void *array, size_t count, size_t size,
       const void *target,
-      algo_compare_func *compare, void *aux) 
+      algo_compare_func *compare, const void *aux) 
 {
   const char *element = array;
 
@@ -130,7 +130,7 @@
 size_t
 count_equal (const void *array, size_t count, size_t size,
              const void *element,
-             algo_compare_func *compare, void *aux)
+             algo_compare_func *compare, const void *aux)
 {
   const char *first = array;
   size_t equal_cnt = 0;
@@ -152,7 +152,7 @@
    PREDICATE. */
 size_t
 count_if (const void *array, size_t count, size_t size,
-          algo_predicate_func *predicate, void *aux) 
+          algo_predicate_func *predicate, const void *aux) 
 {
   const char *first = array;
   size_t true_cnt = 0;
@@ -187,7 +187,7 @@
    arrays only.  Arguments same as for sort() above. */
 size_t
 unique (void *array, size_t count, size_t size,
-        algo_compare_func *compare, void *aux) 
+        algo_compare_func *compare, const void *aux) 
 {
   char *first = array;
   char *last = first + size * count;
@@ -217,7 +217,7 @@
 /* Helper function that calls sort(), then unique(). */
 size_t
 sort_unique (void *array, size_t count, size_t size,
-             algo_compare_func *compare, void *aux) 
+             algo_compare_func *compare, const void *aux) 
 {
   sort (array, count, size, compare, aux);
   return unique (array, count, size, compare, aux);
@@ -231,7 +231,7 @@
    stable. */
 size_t 
 partition (void *array, size_t count, size_t size,
-           algo_predicate_func *predicate, void *aux) 
+           algo_predicate_func *predicate, const void *aux) 
 {
   size_t true_cnt = count;
   char *first = array;
@@ -285,7 +285,7 @@
 bool
 is_partitioned (const void *array, size_t count, size_t size,
                 size_t true_cnt,
-                algo_predicate_func *predicate, void *aux) 
+                algo_predicate_func *predicate, const void *aux) 
 {
   const char *first = array;
   size_t idx;
@@ -307,7 +307,7 @@
 size_t 
 copy_if (const void *array, size_t count, size_t size,
          void *result,
-         algo_predicate_func *predicate, void *aux) 
+         algo_predicate_func *predicate, const void *aux) 
 {
   const char *input = array;
   const char *last = input + size * count;
@@ -394,11 +394,11 @@
 struct pred_aux 
   {
     algo_predicate_func *predicate;
-    void *aux;
+    const void *aux;
   };
 
 static bool
-not (const void *data, void *pred_aux_) 
+not (const void *data, const void *pred_aux_) 
 {
   const struct pred_aux *pred_aux = pred_aux_;
 
@@ -412,7 +412,7 @@
 size_t
 remove_equal (void *array, size_t count, size_t size,
               void *element,
-              algo_compare_func *compare, void *aux) 
+              algo_compare_func *compare, const void *aux) 
 {
   char *first = array;
   char *last = first + count * size;
@@ -458,7 +458,7 @@
 size_t 
 remove_copy_if (const void *array, size_t count, size_t size,
                 void *result,
-                algo_predicate_func *predicate, void *aux) 
+                algo_predicate_func *predicate, const void *aux) 
 {
   struct pred_aux pred_aux;
   pred_aux.predicate = predicate;
@@ -474,7 +474,7 @@
 void *
 binary_search (const void *array, size_t count, size_t size,
                void *value,
-               algo_compare_func *compare, void *aux) 
+               algo_compare_func *compare, const void *aux) 
 {
   assert (array != NULL);
   assert (count <= INT_MAX);
@@ -514,7 +514,7 @@
 lexicographical_compare_3way (const void *array1, size_t count1,
                               const void *array2, size_t count2,
                               size_t size,
-                              algo_compare_func *compare, void *aux) 
+                              algo_compare_func *compare, const void *aux) 
 {
   const char *first1 = array1;
   const char *first2 = array2;
@@ -779,7 +779,7 @@
                        const void *array2, size_t count2,
                        size_t size,
                        void *result_,
-                       algo_compare_func *compare, void *aux) 
+                       algo_compare_func *compare, const void *aux) 
 {
   const char *first1 = array1;
   const char *last1 = first1 + count1 * size;
@@ -826,7 +826,7 @@
    data. */
 void *
 adjacent_find_equal (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;
   const char *last = first + count * size;
@@ -849,7 +849,7 @@
    data. */
 void
 push_heap (void *array, size_t count, size_t size,
-           algo_compare_func *compare, void *aux) 
+           algo_compare_func *compare, const void *aux) 
 {
   char *first = array;
   size_t i;
@@ -876,7 +876,7 @@
 static void
 heapify (void *array, size_t count, size_t size,
          size_t idx,
-         algo_compare_func *compare, void *aux) 
+         algo_compare_func *compare, const void *aux) 
 {
   char *first = array;
   
@@ -912,7 +912,7 @@
    AUX as auxiliary data. */
 void
 pop_heap (void *array, size_t count, size_t size,
-          algo_compare_func *compare, void *aux) 
+          algo_compare_func *compare, const void *aux) 
 {
   char *first = array;
 
@@ -928,7 +928,7 @@
    auxiliary data. */
 void
 make_heap (void *array, size_t count, size_t size,
-           algo_compare_func *compare, void *aux) 
+           algo_compare_func *compare, const void *aux) 
 {
   size_t idx;
   
@@ -943,7 +943,7 @@
    passing AUX as auxiliary data. */
 void
 sort_heap (void *array, size_t count, size_t size,
-           algo_compare_func *compare, void *aux) 
+           algo_compare_func *compare, const void *aux) 
 {
   char *first = array;
   size_t idx;
@@ -963,7 +963,7 @@
    AUX as auxiliary data. */
 bool
 is_heap (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 child;

Index: libpspp/array.h
===================================================================
RCS file: /sources/pspp/pspp/src/libpspp/array.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- libpspp/array.h     29 Oct 2006 09:51:36 -0000      1.5
+++ libpspp/array.h     29 Oct 2006 11:16:07 -0000      1.6
@@ -10,11 +10,11 @@
 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);
+typedef bool algo_predicate_func (const void *data, const void *aux);
 
 /* Returns a random number in the range 0 through MAX exclusive,
    given auxiliary data AUX. */
-typedef unsigned algo_random_func (unsigned max, void *aux);
+typedef unsigned algo_random_func (unsigned max, const void *aux);
 
 /* A generally suitable random function. */
 algo_random_func algo_default_random;
@@ -26,7 +26,7 @@
    data. */
 void *find (const void *array, size_t count, size_t size,
             const void *target,
-            algo_compare_func *compare, void *aux);
+            algo_compare_func *compare, const void *aux);
 
 /* Counts and return the number of elements in ARRAY, which
    contains COUNT elements of SIZE bytes each, which are equal to
@@ -34,14 +34,14 @@
    data to COMPARE. */
 size_t count_equal (const void *array, size_t count, size_t size,
                     const void *element,
-                    algo_compare_func *compare, void *aux);
+                    algo_compare_func *compare, const void *aux);
 
 /* Counts and return the number of elements in ARRAY, which
    contains COUNT elements of SIZE bytes each, for which
    PREDICATE returns true.  AUX is passed as auxiliary data to
    PREDICATE. */
 size_t count_if (const void *array, size_t count, size_t size,
-                 algo_predicate_func *predicate, void *aux);
+                 algo_predicate_func *predicate, const void *aux);
 
 /* Sorts ARRAY, which contains COUNT elements of SIZE bytes each,
    using COMPARE for comparisons.  AUX is passed to each
@@ -59,11 +59,11 @@
    and returns the new number of elements in the array.  Sorted
    arrays only.  Arguments same as for sort() above. */
 size_t unique (void *array, size_t count, size_t size,
-               algo_compare_func *compare, void *aux);
+               algo_compare_func *compare, const void *aux);
 
 /* Helper function that calls sort(), then unique(). */
 size_t sort_unique (void *array, size_t count, size_t size,
-                    algo_compare_func *compare, void *aux);
+                    algo_compare_func *compare, const void *aux);
 
 /* Reorders ARRAY, which contains COUNT elements of SIZE bytes
    each, so that the elements for which PREDICATE returns true
@@ -71,7 +71,7 @@
    as auxiliary data to PREDICATE.  Returns the number of
    elements for which PREDICATE returns true.  Not stable. */
 size_t partition (void *array, size_t count, size_t size,
-                  algo_predicate_func *predicate, void *aux);
+                  algo_predicate_func *predicate, const void *aux);
 
 /* Checks whether ARRAY, which contains COUNT elements of SIZE
    bytes each, is partitioned such that PREDICATE returns true
@@ -79,14 +79,14 @@
    elements.  AUX is passed as auxiliary data to PREDICATE. */
 bool is_partitioned (const void *array, size_t count, size_t size,
                     size_t true_cnt,
-                    algo_predicate_func *predicate, void *aux);
+                    algo_predicate_func *predicate, const void *aux);
 
 /* Randomly reorders ARRAY, which contains COUNT elements of SIZE
    bytes each.  Uses RANDOM as a source of random data, passing
    AUX as the auxiliary data.  RANDOM may be null to use a
    default random source. */
 void random_shuffle (void *array, size_t count, size_t size,
-                     algo_random_func *random, void *aux);
+                     algo_random_func *random, const void *aux);
 
 /* Copies the COUNT elements of SIZE bytes each from ARRAY to
    RESULT, except that elements for which PREDICATE is false are
@@ -94,7 +94,7 @@
    passed to PREDICATE as auxiliary data.  */
 size_t copy_if (const void *array, size_t count, size_t size,
                 void *result,
-                algo_predicate_func *predicate, void *aux);
+                algo_predicate_func *predicate, const void *aux);
 
 /* Removes N elements starting at IDX from ARRAY, which consists
    of COUNT elements of SIZE bytes each, by shifting the elements
@@ -121,7 +121,7 @@
    data. */
 size_t remove_equal (void *array, size_t count, size_t size,
                      void *element,
-                     algo_compare_func *compare, void *aux);
+                     algo_compare_func *compare, const void *aux);
 
 /* Copies the COUNT elements of SIZE bytes each from ARRAY to
    RESULT, except that elements for which PREDICATE is true are
@@ -129,7 +129,7 @@
    passed to PREDICATE as auxiliary data.  */
 size_t remove_copy_if (const void *array, size_t count, size_t size,
                        void *result,
-                       algo_predicate_func *predicate, void *aux);
+                       algo_predicate_func *predicate, const void *aux);
 
 /* Searches ARRAY, which contains COUNT elements of SIZE bytes
    each, for VALUE, using a binary search.  ARRAY must ordered
@@ -137,7 +137,7 @@
    data. */
 void *binary_search (const void *array, size_t count, size_t size,
                      void *value,
-                     algo_compare_func *compare, void *aux);
+                     algo_compare_func *compare, const void *aux);
 
 /* Lexicographically compares ARRAY1, which contains COUNT1
    elements of SIZE bytes each, to ARRAY2, which contains COUNT2
@@ -147,7 +147,7 @@
 int lexicographical_compare_3way (const void *array1, size_t count1,
                                   const void *array2, size_t count2,
                                   size_t size,
-                                  algo_compare_func *compare, void *aux);
+                                  algo_compare_func *compare, const void *aux);
 
 /* Computes the generalized set difference, ARRAY1 minus ARRAY2,
    into RESULT, and returns the number of elements written to
@@ -161,7 +161,7 @@
                        const void *array2, size_t count2,
                        size_t size,
                        void *result,
-                       algo_compare_func *compare, void *aux);
+                       algo_compare_func *compare, const void *aux);
 
 /* Finds the first pair of adjacent equal elements in ARRAY,
    which has COUNT elements of SIZE bytes.  Returns the first
@@ -169,7 +169,7 @@
    its successor element are compared.  AUX is passed to COMPARE
    as auxiliary data. */
 void *adjacent_find_equal (const void *array, size_t count, size_t size,
-                           algo_compare_func *compare, void *aux);
+                           algo_compare_func *compare, const void *aux);
 
 /* ARRAY contains COUNT elements of SIZE bytes each.  Initially
    the first COUNT - 1 elements of these form a heap, followed by
@@ -178,7 +178,7 @@
    Uses COMPARE to compare elements, passing AUX as auxiliary
    data. */
 void push_heap (void *array, size_t count, size_t size,
-                algo_compare_func *compare, void *aux);
+                algo_compare_func *compare, const void *aux);
 
 /* ARRAY contains COUNT elements of SIZE bytes each.  Initially
    all COUNT elements form a heap.  This function moves the
@@ -187,27 +187,27 @@
    beginning of ARRAY.  Uses COMPARE to compare elements, passing
    AUX as auxiliary data. */
 void pop_heap (void *array, size_t count, size_t size,
-               algo_compare_func *compare, void *aux);
+               algo_compare_func *compare, const void *aux);
 
 /* Turns ARRAY, which contains COUNT elements of SIZE bytes, into
    a heap.  Uses COMPARE to compare elements, passing AUX as
    auxiliary data. */
 void make_heap (void *array, size_t count, size_t size,
-                algo_compare_func *compare, void *aux);
+                algo_compare_func *compare, const void *aux);
 
 /* ARRAY contains COUNT elements of SIZE bytes each.  Initially
    all COUNT elements form a heap.  This function turns the heap
    into a fully sorted array.  Uses COMPARE to compare elements,
    passing AUX as auxiliary data. */
 void sort_heap (void *array, size_t count, size_t size,
-                algo_compare_func *compare, void *aux);
+                algo_compare_func *compare, const void *aux);
 
 /* ARRAY contains COUNT elements of SIZE bytes each.  This
    function tests whether ARRAY is a heap and returns true if so, 
    false otherwise.  Uses COMPARE to compare elements, passing 
    AUX as auxiliary data. */
 bool is_heap (const void *array, size_t count, size_t size,
-             algo_compare_func *compare, void *aux);
+             algo_compare_func *compare, const void *aux);
 
 
 #endif /* algorithm.h */

Index: libpspp/hash.c
===================================================================
RCS file: /sources/pspp/pspp/src/libpspp/hash.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- libpspp/hash.c      29 Oct 2006 09:51:36 -0000      1.8
+++ libpspp/hash.c      29 Oct 2006 11:16:07 -0000      1.9
@@ -167,7 +167,7 @@
 
 struct hsh_table *
 hsh_create (int size, hsh_compare_func *compare, hsh_hash_func *hash,
-            hsh_free_func *free, void *aux)
+            hsh_free_func *free, const void *aux)
 {
   return hsh_create_pool (NULL, size, compare, hash, free, aux);
 }
@@ -181,7 +181,7 @@
 struct hsh_table *
 hsh_create_pool (struct pool *pool, int size, 
                 hsh_compare_func *compare, hsh_hash_func *hash,
-                hsh_free_func *free, void *aux)
+                hsh_free_func *free, const void *aux)
 {
   struct hsh_table *h;
   int i;
@@ -323,7 +323,7 @@
 /* A "algo_predicate_func" that returns true if DATA points
    to a non-null void. */
 static bool
-not_null (const void *data_, void *aux UNUSED) 
+not_null (const void *data_, const void *aux UNUSED) 
 {
   void *const *data = data_;
 

Index: libpspp/hash.h
===================================================================
RCS file: /sources/pspp/pspp/src/libpspp/hash.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- libpspp/hash.h      29 Oct 2006 09:51:36 -0000      1.5
+++ libpspp/hash.h      29 Oct 2006 11:16:07 -0000      1.6
@@ -43,13 +43,13 @@
 /* Hash tables. */
 struct hsh_table *hsh_create (int m, hsh_compare_func *,
                               hsh_hash_func *, hsh_free_func *,
-                             void *aux);
+                             const void *aux);
 
 struct pool;
 struct hsh_table *hsh_create_pool (struct pool *pool, int m, 
                                   hsh_compare_func *,
                                   hsh_hash_func *, hsh_free_func *,
-                                  void *aux);
+                                  const void *aux);
 
 void hsh_clear (struct hsh_table *);
 void hsh_destroy (struct hsh_table *);




reply via email to

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