Make list_length and string_item_to_ipaddr const-correct.
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 2 Sep 2014 07:56:50 +0000 (08:56 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 5 Oct 2014 20:28:20 +0000 (21:28 +0100)
No functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
conffile.c
ipaddr.c
ipaddr.h
secnet.h

index ede9c49..24d7e25 100644 (file)
@@ -561,10 +561,10 @@ list_t *list_new(void)
     return NULL;
 }
 
-int32_t list_length(list_t *a)
+int32_t list_length(const list_t *a)
 {
     int32_t l=0;
-    list_t *i;
+    const list_t *i;
     for (i=a; i; i=i->next) { assert(l < INT_MAX); l++; }
     return l;
 }
index d23317c..09eb80d 100644 (file)
--- a/ipaddr.c
+++ b/ipaddr.c
@@ -418,7 +418,7 @@ static struct subnet string_item_to_subnet(item_t *i, cstring_t desc,
     return s;
 }
 
-uint32_t string_item_to_ipaddr(item_t *i, cstring_t desc)
+uint32_t string_item_to_ipaddr(const item_t *i, cstring_t desc)
 {
     uint32_t a, b, c, d;
     int match;
index 54f10d4..de41b7d 100644 (file)
--- a/ipaddr.h
+++ b/ipaddr.h
@@ -53,6 +53,6 @@ extern string_t subnet_to_string(struct subnet sn);
 extern struct ipset *string_list_to_ipset(list_t *l,struct cloc loc,
                                          cstring_t module, cstring_t param);
                                          
-extern uint32_t string_item_to_ipaddr(item_t *i, cstring_t desc);
+extern uint32_t string_item_to_ipaddr(const item_t *i, cstring_t desc);
 
 #endif /* ipaddr_h */
index 628a755..78dc676 100644 (file)
--- a/secnet.h
+++ b/secnet.h
@@ -114,7 +114,7 @@ extern cstring_t *dict_keys(dict_t *dict);
 
 /* List-manipulation functions */
 extern list_t *list_new(void);
-extern int32_t list_length(list_t *a);
+extern int32_t list_length(const list_t *a);
 extern list_t *list_append(list_t *a, item_t *i);
 extern list_t *list_append_list(list_t *a, list_t *b);
 /* Returns an item from the list (index starts at 0), or NULL */