summaryrefslogtreecommitdiff
path: root/src/list.c
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2022-01-11 09:58:43 +0800
committerJSDurand <mmemmew@gmail.com>2022-01-11 09:58:43 +0800
commit91016bd3855375796fd1eabd501ebc12491f2655 (patch)
treec4a608966b686c9639a90b92c31c00632532fac8 /src/list.c
parent949888ad5d0cd0f9f9a87f9938a632b3e32df051 (diff)
Add the framework for character classes.
Now we have the potential to recognize character classes. But the most important task for us now is to experiment with ((B)RN)GLR algorithms, so we leave the character classes at the present state for a moment.
Diffstat (limited to 'src/list.c')
-rw-r--r--src/list.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/list.c b/src/list.c
index 143c693..3c430f6 100644
--- a/src/list.c
+++ b/src/list.c
@@ -32,7 +32,7 @@ new_list()
}
H_ATTR
-unsigned char
+BOOL
add_to_list(List *ls, void *element)
{
if (!(ls->capacity)) {
@@ -141,10 +141,10 @@ copy_num(void *p)
return pointer;
}
-unsigned char
+BOOL
copy_list(List *dest, List *source, copyer copyf)
{
- unsigned char sign = 0;
+ BOOL sign = 0;
if ((sign = list_assure_size(dest, source->len)))
return sign;
@@ -162,19 +162,19 @@ copy_list(List *dest, List *source, copyer copyf)
H_ATTR
void *
-list_nth(List *ls, NUM n)
+list_nth(const List * const ls, NUM n)
{
return *(ls->array+n);
}
H_ATTR
NUM
-list_length(List *ls)
+list_length(const List * const restrict ls)
{
return ls->len;
}
-unsigned char
+BOOL
list_assure_size(List *ls, NUM size)
{
if (ls->capacity >= size) return 0; /* we are good */
@@ -203,7 +203,7 @@ list_assure_size(List *ls, NUM size)
return 0;
}
-unsigned char
+BOOL
list_set_length(List *ls, NUM len)
{
list_assure_size(ls, len);
@@ -254,7 +254,7 @@ array_to_list(void **array, NUM size)
}
void
-destroy_list(List *ls, unsigned char all_free_p)
+destroy_list(List *ls, BOOL all_free_p)
{
if (all_free_p == 1)
for (NUM i = 0; i < ls->len; i++)