#include "globals.h"
#include "cl.h"
#include "macros.h"
#include "list.h"
#define LUMPSIZE 64 |
Default size of steps (lumps) by which auto-growing lists are extended.
List functions automatically extend lists in steps of at least LUMPSIZE cells (to avoid too frequent reallocs).
This can be configured on a per-list-object basis with cl_int_list_lumpsize() and cl_string_list_lumpsize().
Referenced by cl_int_list_lumpsize(), cl_new_int_list(), cl_new_string_list(), and cl_string_list_lumpsize().
void cl_delete_int_list | ( | cl_int_list | l | ) |
Deletes a cl_int_list object.
References cl_free, and _cl_int_list::data.
void cl_delete_string_list | ( | cl_string_list | l | ) |
Deletes a cl_string_list object.
References cl_free, and _cl_string_list::data.
Referenced by cl_make_set(), main(), and parse_options().
void cl_free_string_list | ( | cl_string_list | l | ) |
Frees all the strings in the cl_string_list object.
References cl_free, _cl_string_list::data, and _cl_string_list::size.
Referenced by main().
void cl_int_list_append | ( | cl_int_list | l, | |
int | val | |||
) |
Appends an integer to the end of a cl_int_list object.
References cl_int_list_set(), and _cl_int_list::size.
int cl_int_list_get | ( | cl_int_list | l, | |
int | n | |||
) |
Retrieves an element from a cl_int_list object.
l | The list to search. | |
n | The element to retrieve. |
References _cl_int_list::data, and _cl_int_list::size.
int cl_int_list_intcmp | ( | const void * | a, | |
const void * | b | |||
) |
comparison function for int list sort : non-exported
Referenced by cl_int_list_qsort().
void cl_int_list_lumpsize | ( | cl_int_list | l, | |
int | s | |||
) |
Sets the lumpsize of a cl_int_list object.
l | The cl_int_list. | |
s | The new lumpsize. |
References _cl_int_list::lumpsize, and LUMPSIZE.
void cl_int_list_qsort | ( | cl_int_list | l | ) |
Sorts a cl_int_list object.
The list of integers are sorted into ascending order.
References cl_int_list_intcmp(), _cl_int_list::data, and _cl_int_list::size.
void cl_int_list_set | ( | cl_int_list | l, | |
int | n, | |||
int | val | |||
) |
Sets an integer on a cl_int_list object.
The n'th element on the list is set to val, and the list is auto-extended if necessary.
References _cl_int_list::allocated, cl_realloc(), _cl_int_list::data, _cl_int_list::lumpsize, and _cl_int_list::size.
Referenced by cl_int_list_append().
int cl_int_list_size | ( | cl_int_list | l | ) |
Gets the current size of a cl_int_list object (number of elements on the list).
References _cl_int_list::size.
cl_int_list cl_new_int_list | ( | void | ) |
Creates a new cl_int_list object.
References _cl_int_list::allocated, cl_calloc(), cl_malloc(), _cl_int_list::data, _cl_int_list::lumpsize, LUMPSIZE, and _cl_int_list::size.
cl_string_list cl_new_string_list | ( | void | ) |
Creates a new cl_string_list object.
References _cl_string_list::allocated, cl_calloc(), cl_malloc(), _cl_string_list::data, _cl_string_list::lumpsize, LUMPSIZE, and _cl_string_list::size.
Referenced by cl_make_set(), cwbci_parse_options(), declare_range(), main(), and scan_directory().
void cl_string_list_append | ( | cl_string_list | l, | |
char * | val | |||
) |
Appends a string pointer to the end of a cl_string_list object.
References cl_string_list_set(), and _cl_string_list::size.
Referenced by cl_make_set(), cwbci_check_line(), declare_range(), parse_options(), and scan_directory().
char* cl_string_list_get | ( | cl_string_list | l, | |
int | n | |||
) |
Retrieves an element from a cl_string_list object.
l | The list to search. | |
n | The element to retrieve. |
References _cl_string_list::data, and _cl_string_list::size.
Referenced by cl_make_set(), close_range(), cwbci_check_line(), get_input_line(), main(), open_range(), parse_options(), and print_range_registry_line().
void cl_string_list_lumpsize | ( | cl_string_list | l, | |
int | s | |||
) |
Sets the lumpsize of a cl_string_list object.
l | The cl_string_list. | |
s | The new lumpsize. |
References _cl_string_list::lumpsize, and LUMPSIZE.
void cl_string_list_qsort | ( | cl_string_list | l | ) |
Sorts a cl_string_list object.
The list of strings is sorted using cl_strcmp().
References cl_string_list_strcmp(), _cl_string_list::data, and _cl_string_list::size.
Referenced by cl_make_set(), and scan_directory().
void cl_string_list_set | ( | cl_string_list | l, | |
int | n, | |||
char * | val | |||
) |
Sets a string pointer on a cl_string_list object.
The n'th element on the list is set to val, and the list is auto-extended if necessary.
References _cl_string_list::allocated, cl_realloc(), _cl_string_list::data, _cl_string_list::lumpsize, and _cl_string_list::size.
Referenced by cl_string_list_append().
int cl_string_list_size | ( | cl_string_list | l | ) |
Gets the current size of a cl_string_list object (number of elements on the list).
References _cl_string_list::size.
Referenced by cl_make_set(), close_range(), cwbci_check_line(), main(), open_range(), parse_options(), and print_range_registry_line().
int cl_string_list_strcmp | ( | const void * | a, | |
const void * | b | |||
) |
comparison function for string list sort : non-exported
References cl_strcmp().
Referenced by cl_string_list_qsort().