/* 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_;
/* 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);
}
};
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;
}
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;
}
static void
-pair_sn_free(void *p, void *aux UNUSED)
+pair_sn_free(void *p, const void *aux UNUSED)
{
free(p);
}
\f
/* 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_;
/* 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_;
/* 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_;
/* 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_;
/* 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_;
/* 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_;
/* 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_;
/* 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_;
/* 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_;
/* 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_;
/* 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 *);
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 *,
/* 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_;
/* 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;
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
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_;
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_;
/* 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_;
}
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_;
}
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_;
}
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_;
\f
/* 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
/* 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_;
/* 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;
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_;
/* 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;
};
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);
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;
/* 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);
/* 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);
/* 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_;
/* 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);
/* 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);
}
/* 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_;
/* 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)
/* 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_;
/* 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)
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;
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;
/* 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);
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
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;
/* 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);
#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
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. */
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);
};
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
/* 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;
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)
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);
}