[PATCH 18/31] Make list_length and string_item_to_ipaddr const-correct.
Ian Jackson
ijackson at chiark.greenend.org.uk
Sat Sep 20 01:32:13 BST 2014
No functional change.
Signed-off-by: Ian Jackson <ijackson at chiark.greenend.org.uk>
---
conffile.c | 4 ++--
ipaddr.c | 2 +-
ipaddr.h | 2 +-
secnet.h | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
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 f83d14a..7935709 100644
--- a/secnet.h
+++ b/secnet.h
@@ -112,7 +112,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 */
--
1.7.10.4
More information about the sgo-software-discuss
mailing list