From e6e6728fd04d7cbaeee7f8ef4733a77557786a8b Mon Sep 17 00:00:00 2001 From: jvoisin Date: Fri, 6 Nov 2020 17:05:40 +0100 Subject: Constify a bit more --- src/sp_list.c | 3 ++- src/sp_list.h | 4 ++-- src/sp_var_parser.c | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') 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) { // Thanks to https://en.wikipedia.org/wiki/Insertion_sort :> sp_list_node *sp_list_sort(sp_list_node *pList, - int (*cmp_func)(sp_list_node *, sp_list_node *)) { + int (*cmp_func)(sp_list_node const *const, + sp_list_node const *const)) { sp_list_node *head = NULL; 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 { } sp_list_node; -sp_list_node *sp_list_sort(sp_list_node *, - int (*)(sp_list_node *, sp_list_node *)); +sp_list_node *sp_list_sort(sp_list_node *, int (*)(sp_list_node const *const, + sp_list_node const *const)); sp_list_node *sp_list_insert(sp_list_node *, void *); sp_list_node *sp_list_prepend(sp_list_node *, void *); void 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, return 0; } -int cmp_tokens(sp_list_node *list1, sp_list_node *list2) { +int cmp_tokens(sp_list_node const *const list1, + sp_list_node const *const list2) { return (((sp_conf_token *)list1->data)->pos - ((sp_conf_token *)list2->data)->pos); } -- cgit v1.3