Mercurial > dovecot > original-hg > dovecot-1.2
changeset 3861:398dcca97d24 HEAD
Cleanup + removed compiler warnings with 64bit systems
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 13 Jan 2006 17:10:24 +0200 |
parents | 0d5d42c49b51 |
children | ea1571f17b96 |
files | src/lib/ioloop-poll.c |
diffstat | 1 files changed, 21 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib/ioloop-poll.c Fri Jan 13 14:49:59 2006 +0200 +++ b/src/lib/ioloop-poll.c Fri Jan 13 17:10:24 2006 +0200 @@ -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);