From 17c3451c18389990d74936e79ee19a4aa15e97d0 Mon Sep 17 00:00:00 2001 From: "/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org" Date: Tue, 15 Jan 2008 12:53:58 +0000 Subject: Max Kellermann : use const when possible --- ChangeLog | 1 + include/buffer.h | 2 +- include/cache.h | 2 +- include/hash.h | 2 +- include/queue.h | 2 +- src/buffer.c | 2 +- src/cache.c | 2 +- src/hash.c | 2 +- src/queue.c | 2 +- src/sync-ftfw.c | 4 ++-- 10 files changed, 11 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index dcbe694..e1330bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -47,6 +47,7 @@ Max Kellermann : o resolve global variable "alarm" conflict with alarm() function in unistd.h. o enable gcc warnings, including -Werror o use list_for_each_entry() instead of list_for_each() +o use const when possible version 0.9.5 (2007/07/29) ------------------------------ diff --git a/include/buffer.h b/include/buffer.h index 5b854f3..aa753b4 100644 --- a/include/buffer.h +++ b/include/buffer.h @@ -13,6 +13,6 @@ void buffer_flush(struct buffer *b, void (*cb)(void *buffer_data, void *data), void *data); -unsigned int buffer_size(struct buffer *b); +unsigned int buffer_size(const struct buffer *b); #endif diff --git a/include/cache.h b/include/cache.h index f5e9576..5ca6ce4 100644 --- a/include/cache.h +++ b/include/cache.h @@ -83,7 +83,7 @@ struct us_conntrack *cache_update(struct cache *c, struct nf_conntrack *ct); struct us_conntrack *cache_update_force(struct cache *c, struct nf_conntrack *ct); int cache_del(struct cache *c, struct nf_conntrack *ct); int cache_test(struct cache *c, struct nf_conntrack *ct); -void cache_stats(struct cache *c, int fd); +void cache_stats(const struct cache *c, int fd); struct us_conntrack *cache_get_conntrack(struct cache *, void *); void *cache_get_extra(struct cache *, void *); void cache_iterate(struct cache *c, void *data, int (*iterate)(void *data1, void *data2)); diff --git a/include/hash.h b/include/hash.h index fd971e7..c9460fa 100644 --- a/include/hash.h +++ b/include/hash.h @@ -42,6 +42,6 @@ int hashtable_del(struct hashtable *table, void *data); int hashtable_flush(struct hashtable *table); int hashtable_iterate(struct hashtable *table, void *data, int (*iterate)(void *data1, void *data2)); -unsigned int hashtable_counter(struct hashtable *table); +unsigned int hashtable_counter(const struct hashtable *table); #endif diff --git a/include/queue.h b/include/queue.h index 691138f..f568da4 100644 --- a/include/queue.h +++ b/include/queue.h @@ -21,7 +21,7 @@ struct queue_node { struct queue *queue_create(size_t max_size); void queue_destroy(struct queue *b); -unsigned int queue_len(struct queue *b); +unsigned int queue_len(const struct queue *b); int queue_add(struct queue *b, const void *data, size_t size); void queue_del(struct queue *b, void *data); void queue_iterate(struct queue *b, diff --git a/src/buffer.c b/src/buffer.c index 3283c15..4f60123 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -61,7 +61,7 @@ void buffer_flush(struct buffer *b, memset(b->data, 0, b->size); } -unsigned int buffer_size(struct buffer *b) +unsigned int buffer_size(const struct buffer *b) { return b->size; } diff --git a/src/cache.c b/src/cache.c index b92957a..a0950d5 100644 --- a/src/cache.c +++ b/src/cache.c @@ -398,7 +398,7 @@ void *cache_get_extra(struct cache *c, void *data) return data + c->extra_offset; } -void cache_stats(struct cache *c, int fd) +void cache_stats(const struct cache *c, int fd) { char buf[512]; int size; diff --git a/src/hash.c b/src/hash.c index 274a140..3ed6ad2 100644 --- a/src/hash.c +++ b/src/hash.c @@ -193,7 +193,7 @@ int hashtable_iterate(struct hashtable *table, void *data, return 0; } -unsigned int hashtable_counter(struct hashtable *table) +unsigned int hashtable_counter(const struct hashtable *table) { return table->count; } diff --git a/src/queue.c b/src/queue.c index 3413013..e73d692 100644 --- a/src/queue.c +++ b/src/queue.c @@ -122,7 +122,7 @@ void queue_iterate(struct queue *b, } } -unsigned int queue_len(struct queue *b) +unsigned int queue_len(const struct queue *b) { return b->num_elems; } diff --git a/src/sync-ftfw.c b/src/sync-ftfw.c index 8452e2e..0d57f36 100644 --- a/src/sync-ftfw.c +++ b/src/sync-ftfw.c @@ -161,7 +161,7 @@ static int ftfw_local(int fd, int type, void *data) static int rs_queue_to_tx(void *data1, void *data2) { struct nethdr *net = data1; - struct nethdr_ack *nack = data2; + const struct nethdr_ack *nack = data2; if (between(net->seq, nack->from, nack->to)) { dp("rs_queue_to_tx sq: %u fl:%u len:%u\n", @@ -174,7 +174,7 @@ static int rs_queue_to_tx(void *data1, void *data2) static int rs_queue_empty(void *data1, void *data2) { struct nethdr *net = data1; - struct nethdr_ack *h = data2; + const struct nethdr_ack *h = data2; if (between(net->seq, h->from, h->to)) { dp("remove from queue (seq=%u)\n", net->seq); -- cgit v1.2.3