aboutsummaryrefslogtreecommitdiffstats
path: root/channel.c
diff options
context:
space:
mode:
authorrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-04-16 13:27:58 +0000
committerrizzo <rizzo@f38db490-d61c-443f-a65b-d21fe96a405b>2006-04-16 13:27:58 +0000
commit1ee63a0193aa6da19e4caf2bb7c02fc69a11d065 (patch)
tree5c91277f54f86bf5f4f71b08835f80942c83a024 /channel.c
parentd2a8739e6d29ff1a9f453d0793efe613cd4ea351 (diff)
Localize some variables documenting their usage.
Comment a possible problem with locking. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@20453 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channel.c')
-rw-r--r--channel.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/channel.c b/channel.c
index faf0b3814..921849f34 100644
--- a/channel.c
+++ b/channel.c
@@ -1825,14 +1825,10 @@ int ast_waitfordigit_full(struct ast_channel *c, int ms, int audiofd, int cmdfd)
static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
{
- struct ast_frame *f = NULL;
+ struct ast_frame *f = NULL; /* the return value */
int blah;
int prestate;
-#ifdef ZAPTEL_OPTIMIZATIONS
- int (*func)(void *);
- void *data;
- int res;
-#endif
+
ast_channel_lock(chan);
if (chan->masq) {
if (ast_do_masquerade(chan)) {
@@ -1869,6 +1865,8 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
read(chan->alertpipe[0], &blah, sizeof(blah));
#ifdef ZAPTEL_OPTIMIZATIONS
if (chan->timingfd > -1 && chan->fdno == AST_TIMING_FD && ast_test_flag(chan, AST_FLAG_EXCEPTION)) {
+ int res;
+
ast_clear_flag(chan, AST_FLAG_EXCEPTION);
blah = -1;
/* IF we can't get event, assume it's an expired as-per the old interface */
@@ -1885,13 +1883,11 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
}
} else if (blah == ZT_EVENT_TIMER_EXPIRED) {
ioctl(chan->timingfd, ZT_TIMERACK, &blah);
- func = chan->timingfunc;
- data = chan->timingdata;
- ast_channel_unlock(chan);
- if (func) {
-#if 0
- ast_log(LOG_DEBUG, "Calling private function\n");
-#endif
+ if (chan->timingfunc) {
+ /* save a copy of func/data before unlocking the channel */
+ int (*func)(void *) = chan->timingfunc;
+ void *data = chan->timingdata;
+ ast_channel_unlock(chan);
func(data);
} else {
blah = 0;
@@ -1910,6 +1906,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
if (chan->fds[AST_GENERATOR_FD] > -1 && chan->fdno == AST_GENERATOR_FD) {
void *tmp = chan->generatordata;
chan->generatordata = NULL; /* reset to let ast_write get through */
+ /* XXX don't we miss an ast_channel_unlock(chan); here ? */
chan->generator->generate(chan, tmp, -1, -1);
chan->generatordata = tmp;
return &ast_null_frame;