chiark / gitweb /
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 ede9c49d55eb5c92221525e41d1b9fc936f05477..24d7e25b154e1ec30eaf8b48ce14b9179007b713 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 d23317c90dd1308b6d5a4c53fec0ec89bcdbd217..09eb80df66aaaba86b6ba3c8d8b0e00aaf5da603 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 54f10d434367988a596f526c6fb1f267b75fe544..de41b7db61eccf09a4ee097b0ee42b2087b08d8f 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 628a7555f3e38213eb44efe883fe1250dd8dbf7f..78dc676f4eb72f3180c03601e98917c8b79b6d9f 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 */