summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjvoisin2020-11-06 17:05:40 +0100
committerjvoisin2020-11-06 17:05:40 +0100
commite6e6728fd04d7cbaeee7f8ef4733a77557786a8b (patch)
treea5f793eee3c561314b8ecfd75d0c3228d07f4a70
parent69459369754b07d3fa4379c2b60a5f8ba9fcd45d (diff)
Constify a bit more
-rw-r--r--src/sp_list.c3
-rw-r--r--src/sp_list.h4
-rw-r--r--src/sp_var_parser.c3
3 files changed, 6 insertions, 4 deletions
diff --git a/src/sp_list.c b/src/sp_list.c
index c798d6d..0f00371 100644
--- a/src/sp_list.c
+++ b/src/sp_list.c
@@ -10,7 +10,8 @@ void sp_list_free(sp_list_node *node) {
10 10
11// Thanks to https://en.wikipedia.org/wiki/Insertion_sort :> 11// Thanks to https://en.wikipedia.org/wiki/Insertion_sort :>
12sp_list_node *sp_list_sort(sp_list_node *pList, 12sp_list_node *sp_list_sort(sp_list_node *pList,
13 int (*cmp_func)(sp_list_node *, sp_list_node *)) { 13 int (*cmp_func)(sp_list_node const *const,
14 sp_list_node const *const)) {
14 sp_list_node *head = NULL; 15 sp_list_node *head = NULL;
15 16
16 if (pList == NULL || pList->next == NULL) { 17 if (pList == NULL || pList->next == NULL) {
diff --git a/src/sp_list.h b/src/sp_list.h
index 6b04486..2c91995 100644
--- a/src/sp_list.h
+++ b/src/sp_list.h
@@ -7,8 +7,8 @@ typedef struct sp_node_s {
7 7
8} sp_list_node; 8} sp_list_node;
9 9
10sp_list_node *sp_list_sort(sp_list_node *, 10sp_list_node *sp_list_sort(sp_list_node *, int (*)(sp_list_node const *const,
11 int (*)(sp_list_node *, sp_list_node *)); 11 sp_list_node const *const));
12sp_list_node *sp_list_insert(sp_list_node *, void *); 12sp_list_node *sp_list_insert(sp_list_node *, void *);
13sp_list_node *sp_list_prepend(sp_list_node *, void *); 13sp_list_node *sp_list_prepend(sp_list_node *, void *);
14void sp_list_free(sp_list_node *); 14void sp_list_free(sp_list_node *);
diff --git a/src/sp_var_parser.c b/src/sp_var_parser.c
index 72cbc12..1544030 100644
--- a/src/sp_var_parser.c
+++ b/src/sp_var_parser.c
@@ -85,7 +85,8 @@ static int create_var(sp_tree *tree, const char *restrict value,
85 return 0; 85 return 0;
86} 86}
87 87
88int cmp_tokens(sp_list_node *list1, sp_list_node *list2) { 88int cmp_tokens(sp_list_node const *const list1,
89 sp_list_node const *const list2) {
89 return (((sp_conf_token *)list1->data)->pos - 90 return (((sp_conf_token *)list1->data)->pos -
90 ((sp_conf_token *)list2->data)->pos); 91 ((sp_conf_token *)list2->data)->pos);
91} 92}