summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org>2008-01-17 17:34:56 +0000
committer/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org>2008-01-17 17:34:56 +0000
commitbdbacf04ce2e2d7ddfc7027d08e1290e7d3dc788 (patch)
tree0d5c57ca70dfff032760c61ddb9bb0e451c5d8a4
parenta5cf250034b1f4c3fbd0b2081a756db9b20d9c7e (diff)
downloadconntrack-tools-bdbacf04ce2e2d7ddfc7027d08e1290e7d3dc788.tar.gz
conntrack-tools-bdbacf04ce2e2d7ddfc7027d08e1290e7d3dc788.zip
Max Kellermann <max@duempel.org>:
use size_t for buffer sizes
-rw-r--r--ChangeLog1
-rw-r--r--include/buffer.h12
-rw-r--r--include/conntrackd.h2
-rw-r--r--src/buffer.c6
4 files changed, 12 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 6754908..e0a0da7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -80,6 +80,7 @@ o ignore setsid() failure, because there is only one possible and
o fix harmless error condition
o add buffer_destroy() to buffer.c
o fix memory leaks in several error output paths
+o use size_t for buffer sizes
version 0.9.5 (2007/07/29)
------------------------------
diff --git a/include/buffer.h b/include/buffer.h
index 0d52e72..ab1ccd3 100644
--- a/include/buffer.h
+++ b/include/buffer.h
@@ -1,20 +1,22 @@
#ifndef _BUFFER_H_
#define _BUFFER_H_
+#include <stddef.h>
+
struct buffer {
unsigned char *data;
- unsigned int size;
- unsigned int cur_size;
+ size_t size;
+ size_t cur_size;
};
-struct buffer *buffer_create(unsigned int size);
+struct buffer *buffer_create(size_t size);
void buffer_destroy(struct buffer *b);
-int buffer_add(struct buffer *b, void *data, unsigned int size);
+int buffer_add(struct buffer *b, void *data, size_t size);
void buffer_flush(struct buffer *b,
void (*cb)(void *buffer_data,
void *data),
void *data);
-unsigned int buffer_size(const struct buffer *b);
+size_t buffer_size(const struct buffer *b);
#endif
diff --git a/include/conntrackd.h b/include/conntrackd.h
index 418f4b7..bb4b183 100644
--- a/include/conntrackd.h
+++ b/include/conntrackd.h
@@ -95,7 +95,7 @@ struct ct_conf {
struct {
char logfile[FILENAME_MAXLEN];
int syslog_facility;
- unsigned int buffer_size;
+ size_t buffer_size;
} stats;
};
diff --git a/src/buffer.c b/src/buffer.c
index adde81c..389dd38 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -20,7 +20,7 @@
#include <errno.h>
#include "buffer.h"
-struct buffer *buffer_create(unsigned int size)
+struct buffer *buffer_create(size_t size)
{
struct buffer *b;
@@ -47,7 +47,7 @@ void buffer_destroy(struct buffer *b)
free(b);
}
-int buffer_add(struct buffer *b, void *data, unsigned int size)
+int buffer_add(struct buffer *b, void *data, size_t size)
{
if (b->size - b->cur_size < size) {
errno = ENOSPC;
@@ -68,7 +68,7 @@ void buffer_flush(struct buffer *b,
memset(b->data, 0, b->size);
}
-unsigned int buffer_size(const struct buffer *b)
+size_t buffer_size(const struct buffer *b)
{
return b->size;
}