[dovecot-cvs] dovecot/src/lib ioloop-poll.c,1.29,1.30
cras at dovecot.org
cras at dovecot.org
Fri Jan 13 17:10:26 EET 2006
Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv18741
Modified Files:
ioloop-poll.c
Log Message:
Cleanup + removed compiler warnings with 64bit systems
Index: ioloop-poll.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/ioloop-poll.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- ioloop-poll.c 25 Sep 2005 10:20:40 -0000 1.29
+++ ioloop-poll.c 13 Jan 2006 15:10:24 -0000 1.30
@@ -14,10 +14,10 @@
#endif
struct ioloop_handler_context {
- unsigned int fds_size, fds_pos;
+ unsigned int fds_count, fds_pos;
struct pollfd *fds;
- unsigned int idx_size;
+ unsigned int idx_count;
int *fd_index;
};
@@ -27,12 +27,12 @@
ioloop->handler_context = ctx =
p_new(ioloop->pool, struct ioloop_handler_context, 1);
- ctx->fds_size = INITIAL_POLL_FDS;
- ctx->fds = p_new(ioloop->pool, struct pollfd, ctx->fds_size);
+ ctx->fds_count = INITIAL_POLL_FDS;
+ ctx->fds = p_new(ioloop->pool, struct pollfd, ctx->fds_count);
- ctx->idx_size = INITIAL_POLL_FDS;
- ctx->fd_index = p_new(ioloop->pool, int, ctx->idx_size);
- memset(ctx->fd_index, 0xff, sizeof(int) * ctx->idx_size);
+ ctx->idx_count = INITIAL_POLL_FDS;
+ ctx->fd_index = p_new(ioloop->pool, int, ctx->idx_count);
+ memset(ctx->fd_index, 0xff, sizeof(int) * ctx->idx_count);
}
void io_loop_handler_deinit(struct ioloop *ioloop)
@@ -50,33 +50,31 @@
{
struct ioloop_handler_context *ctx = ioloop->handler_context;
enum io_condition condition = io->condition;
- unsigned int old_size;
+ unsigned int old_count;
int index, fd = io->fd;
- if ((unsigned int)fd >= ctx->idx_size) {
+ if ((unsigned int)fd >= ctx->idx_count) {
/* grow the fd -> index array */
- old_size = ctx->idx_size;
+ old_count = ctx->idx_count;
- ctx->idx_size = nearest_power((unsigned int) fd+1);
- i_assert(ctx->idx_size < (size_t)-1 / sizeof(int));
+ ctx->idx_count = nearest_power((unsigned int) fd+1);
ctx->fd_index = p_realloc(ioloop->pool, ctx->fd_index,
- sizeof(int) * old_size,
- sizeof(int) * ctx->idx_size);
- memset(ctx->fd_index + old_size, 0xff,
- sizeof(int) * (ctx->idx_size-old_size));
+ sizeof(int) * old_count,
+ sizeof(int) * ctx->idx_count);
+ memset(ctx->fd_index + old_count, 0xff,
+ sizeof(int) * (ctx->idx_count-old_count));
}
- if (ctx->fds_pos >= ctx->fds_size) {
+ if (ctx->fds_pos >= ctx->fds_count) {
/* grow the fd array */
- old_size = ctx->fds_size;
+ old_count = ctx->fds_count;
- ctx->fds_size = nearest_power(ctx->fds_size+1);
- i_assert(ctx->fds_size < (size_t)-1 / sizeof(struct pollfd));
+ ctx->fds_count = nearest_power(ctx->fds_count+1);
ctx->fds = p_realloc(ioloop->pool, ctx->fds,
- sizeof(struct pollfd) * old_size,
- sizeof(struct pollfd) * ctx->fds_size);
+ sizeof(struct pollfd) * old_count,
+ sizeof(struct pollfd) * ctx->fds_count);
}
if (ctx->fd_index[fd] != -1) {
@@ -107,7 +105,7 @@
int index, fd = io->fd;
index = ctx->fd_index[fd];
- i_assert(index >= 0 && (unsigned int) index < ctx->fds_size);
+ i_assert(index >= 0 && (unsigned int) index < ctx->fds_count);
if (condition & IO_READ) {
ctx->fds[index].events &= ~(POLLIN|POLLPRI);
More information about the dovecot-cvs
mailing list