233 |
/* A hsh_compare_func that orders variables A and B by their |
/* A hsh_compare_func that orders variables A and B by their |
234 |
names. */ |
names. */ |
235 |
int |
int |
236 |
compare_variables (const void *a_, const void *b_, void *foo UNUSED) |
compare_var_names (const void *a_, const void *b_, void *foo UNUSED) |
237 |
{ |
{ |
238 |
const struct variable *a = a_; |
const struct variable *a = a_; |
239 |
const struct variable *b = b_; |
const struct variable *b = b_; |
243 |
|
|
244 |
/* A hsh_hash_func that hashes variable V based on its name. */ |
/* A hsh_hash_func that hashes variable V based on its name. */ |
245 |
unsigned |
unsigned |
246 |
hash_variable (const void *v_, void *foo UNUSED) |
hash_var_name (const void *v_, void *foo UNUSED) |
247 |
{ |
{ |
248 |
const struct variable *v = v_; |
const struct variable *v = v_; |
249 |
|
|
250 |
return hsh_hash_string (v->name); |
return hsh_hash_string (v->name); |
251 |
} |
} |
252 |
|
|
253 |
|
/* A hsh_compare_func that orders pointers to variables A and B |
254 |
|
by their names. */ |
255 |
|
int |
256 |
|
compare_var_ptr_names (const void *a_, const void *b_, void *foo UNUSED) |
257 |
|
{ |
258 |
|
struct variable *const *a = a_; |
259 |
|
struct variable *const *b = b_; |
260 |
|
|
261 |
|
return strcmp ((*a)->name, (*b)->name); |
262 |
|
} |
263 |
|
|
264 |
|
/* A hsh_hash_func that hashes pointer to variable V based on its |
265 |
|
name. */ |
266 |
|
unsigned |
267 |
|
hash_var_ptr_name (const void *v_, void *foo UNUSED) |
268 |
|
{ |
269 |
|
struct variable *const *v = v_; |
270 |
|
|
271 |
|
return hsh_hash_string ((*v)->name); |
272 |
|
} |