From: Ian Jackson Date: Tue, 2 Sep 2014 07:56:50 +0000 (+0100) Subject: Make list_length and string_item_to_ipaddr const-correct. X-Git-Tag: base.polypath.v1~16 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=secnet.git;a=commitdiff_plain;h=a8a7df626d1419d701e2a898729b9c94ed5b1d41 Make list_length and string_item_to_ipaddr const-correct. No functional change. Signed-off-by: Ian Jackson --- diff --git a/conffile.c b/conffile.c index ede9c49..24d7e25 100644 --- a/conffile.c +++ b/conffile.c @@ -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; } diff --git a/ipaddr.c b/ipaddr.c index d23317c..09eb80d 100644 --- 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; diff --git a/ipaddr.h b/ipaddr.h index 54f10d4..de41b7d 100644 --- 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 */ diff --git a/secnet.h b/secnet.h index 34f24fe..56872ed 100644 --- 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 */