mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-30 10:33:13 +00:00
formatting fixes (bug #4739)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6158 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
22
io.c
22
io.c
@@ -66,7 +66,6 @@ struct io_context {
|
|||||||
int needshrink;
|
int needshrink;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct io_context *io_context_create(void)
|
struct io_context *io_context_create(void)
|
||||||
{
|
{
|
||||||
/* Create an I/O context */
|
/* Create an I/O context */
|
||||||
@@ -82,14 +81,15 @@ struct io_context *io_context_create(void)
|
|||||||
free(tmp);
|
free(tmp);
|
||||||
tmp = NULL;
|
tmp = NULL;
|
||||||
} else {
|
} else {
|
||||||
memset(tmp->fds, 0, (GROW_SHRINK_SIZE/2) * sizeof(struct pollfd));
|
memset(tmp->fds, 0, (GROW_SHRINK_SIZE / 2) * sizeof(struct pollfd));
|
||||||
tmp->ior = malloc((GROW_SHRINK_SIZE/2) * sizeof(struct io_rec));
|
tmp->ior = malloc((GROW_SHRINK_SIZE / 2) * sizeof(struct io_rec));
|
||||||
if (!tmp->ior) {
|
if (!tmp->ior) {
|
||||||
free(tmp->fds);
|
free(tmp->fds);
|
||||||
free(tmp);
|
free(tmp);
|
||||||
tmp = NULL;
|
tmp = NULL;
|
||||||
} else
|
} else {
|
||||||
memset(tmp->ior, 0, (GROW_SHRINK_SIZE/2) * sizeof(struct io_rec));
|
memset(tmp->ior, 0, (GROW_SHRINK_SIZE / 2) * sizeof(struct io_rec));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return tmp;
|
return tmp;
|
||||||
@@ -130,7 +130,6 @@ static int io_grow(struct io_context *ioc)
|
|||||||
ioc->maxfdcnt -= GROW_SHRINK_SIZE;
|
ioc->maxfdcnt -= GROW_SHRINK_SIZE;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* Out of memory. We return to the old size, and return a failure
|
* Out of memory. We return to the old size, and return a failure
|
||||||
@@ -190,7 +189,8 @@ int *ast_io_change(struct io_context *ioc, int *id, int fd, ast_io_cb callback,
|
|||||||
if (data)
|
if (data)
|
||||||
ioc->ior[*id].data = data;
|
ioc->ior[*id].data = data;
|
||||||
return id;
|
return id;
|
||||||
} else return NULL;
|
}
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int io_shrink(struct io_context *ioc)
|
static int io_shrink(struct io_context *ioc)
|
||||||
@@ -202,7 +202,7 @@ static int io_shrink(struct io_context *ioc)
|
|||||||
* the entry we are removing, then decrease the size of the
|
* the entry we are removing, then decrease the size of the
|
||||||
* arrays by one.
|
* arrays by one.
|
||||||
*/
|
*/
|
||||||
for (getfrom=0;getfrom<ioc->fdcnt;getfrom++) {
|
for (getfrom = 0; getfrom < ioc->fdcnt; getfrom++) {
|
||||||
if (ioc->ior[getfrom].id) {
|
if (ioc->ior[getfrom].id) {
|
||||||
/* In use, save it */
|
/* In use, save it */
|
||||||
if (getfrom != putto) {
|
if (getfrom != putto) {
|
||||||
@@ -227,7 +227,7 @@ int ast_io_remove(struct io_context *ioc, int *_id)
|
|||||||
ast_log(LOG_WARNING, "Asked to remove NULL?\n");
|
ast_log(LOG_WARNING, "Asked to remove NULL?\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
for (x=0;x<ioc->fdcnt;x++) {
|
for (x = 0; x < ioc->fdcnt; x++) {
|
||||||
if (ioc->ior[x].id == _id) {
|
if (ioc->ior[x].id == _id) {
|
||||||
/* Free the int immediately and set to NULL so we know it's unused now */
|
/* Free the int immediately and set to NULL so we know it's unused now */
|
||||||
free(ioc->ior[x].id);
|
free(ioc->ior[x].id);
|
||||||
@@ -262,7 +262,7 @@ int ast_io_wait(struct io_context *ioc, int howlong)
|
|||||||
* At least one event
|
* At least one event
|
||||||
*/
|
*/
|
||||||
origcnt = ioc->fdcnt;
|
origcnt = ioc->fdcnt;
|
||||||
for(x=0;x<origcnt;x++) {
|
for(x = 0; x < origcnt; x++) {
|
||||||
/* Yes, it is possible for an entry to be deleted and still have an
|
/* Yes, it is possible for an entry to be deleted and still have an
|
||||||
event waiting if it occurs after the original calling id */
|
event waiting if it occurs after the original calling id */
|
||||||
if (ioc->fds[x].revents && ioc->ior[x].id) {
|
if (ioc->fds[x].revents && ioc->ior[x].id) {
|
||||||
@@ -294,7 +294,7 @@ void ast_io_dump(struct io_context *ioc)
|
|||||||
ast_log(LOG_DEBUG, "================================================\n");
|
ast_log(LOG_DEBUG, "================================================\n");
|
||||||
ast_log(LOG_DEBUG, "| ID FD Callback Data Events |\n");
|
ast_log(LOG_DEBUG, "| ID FD Callback Data Events |\n");
|
||||||
ast_log(LOG_DEBUG, "+------+------+-----------+-----------+--------+\n");
|
ast_log(LOG_DEBUG, "+------+------+-----------+-----------+--------+\n");
|
||||||
for (x=0;x<ioc->fdcnt;x++) {
|
for (x = 0; x < ioc->fdcnt; x++) {
|
||||||
ast_log(LOG_DEBUG, "| %.4d | %.4d | %p | %p | %.6x |\n",
|
ast_log(LOG_DEBUG, "| %.4d | %.4d | %p | %p | %.6x |\n",
|
||||||
*ioc->ior[x].id,
|
*ioc->ior[x].id,
|
||||||
ioc->fds[x].fd,
|
ioc->fds[x].fd,
|
||||||
|
Reference in New Issue
Block a user