diff -Naur asterisk.orig/io.c asterisk/io.c --- asterisk.orig/io.c 2005-07-18 22:20:26.000000000 -0400 +++ asterisk/io.c 2005-07-18 22:26:50.000000000 -0400 @@ -66,7 +66,6 @@ int needshrink; }; - struct io_context *io_context_create(void) { /* Create an I/O context */ @@ -82,14 +81,15 @@ free(tmp); tmp = NULL; } else { - memset(tmp->fds, 0, (GROW_SHRINK_SIZE/2) * sizeof(struct pollfd)); - tmp->ior = malloc((GROW_SHRINK_SIZE/2) * sizeof(struct io_rec)); + memset(tmp->fds, 0, (GROW_SHRINK_SIZE / 2) * sizeof(struct pollfd)); + tmp->ior = malloc((GROW_SHRINK_SIZE / 2) * sizeof(struct io_rec)); if (!tmp->ior) { free(tmp->fds); free(tmp); tmp = NULL; - } else - memset(tmp->ior, 0, (GROW_SHRINK_SIZE/2) * sizeof(struct io_rec)); + } else { + memset(tmp->ior, 0, (GROW_SHRINK_SIZE / 2) * sizeof(struct io_rec)); + } } } return tmp; @@ -130,7 +130,6 @@ ioc->maxfdcnt -= GROW_SHRINK_SIZE; return -1; } - } else { /* * Out of memory. We return to the old size, and return a failure @@ -190,7 +189,8 @@ if (data) ioc->ior[*id].data = data; return id; - } else return NULL; + } + return NULL; } static int io_shrink(struct io_context *ioc) @@ -202,7 +202,7 @@ * the entry we are removing, then decrease the size of the * arrays by one. */ - for (getfrom=0;getfromfdcnt;getfrom++) { + for (getfrom = 0; getfrom < ioc->fdcnt; getfrom++) { if (ioc->ior[getfrom].id) { /* In use, save it */ if (getfrom != putto) { @@ -227,7 +227,7 @@ ast_log(LOG_WARNING, "Asked to remove NULL?\n"); return -1; } - for (x=0;xfdcnt;x++) { + for (x = 0; x < ioc->fdcnt; x++) { if (ioc->ior[x].id == _id) { /* Free the int immediately and set to NULL so we know it's unused now */ free(ioc->ior[x].id); @@ -262,7 +262,7 @@ * At least one event */ origcnt = ioc->fdcnt; - for(x=0;xfds[x].revents && ioc->ior[x].id) { @@ -294,7 +294,7 @@ ast_log(LOG_DEBUG, "================================================\n"); ast_log(LOG_DEBUG, "| ID FD Callback Data Events |\n"); ast_log(LOG_DEBUG, "+------+------+-----------+-----------+--------+\n"); - for (x=0;xfdcnt;x++) { + for (x = 0; x < ioc->fdcnt; x++) { ast_log(LOG_DEBUG, "| %.4d | %.4d | %p | %p | %.6x |\n", *ioc->ior[x].id, ioc->fds[x].fd,