aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-02-27 23:58:49 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-02-27 23:58:49 +0000
commitca10327a0e97714e0d765e2bf5da5b34df1a2972 (patch)
treee5828c209c81bc4e966788e4714f2ba614695f7e /channels
parent002278a62cb1d57af7f03fb5117900876fa54fe3 (diff)
reduce indentation in alloc_sub
(issue #12079) Reported by: tzafrir Patches: alloc_sub uploaded by tzafrir (license 46) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@104866 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_zap.c53
1 files changed, 28 insertions, 25 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index f09dd621f..c48f811a8 100644
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -1149,33 +1149,36 @@ static int alloc_sub(struct zt_pvt *p, int x)
ZT_BUFFERINFO bi;
int res;
if (p->subs[x].zfd < 0) {
- p->subs[x].zfd = zt_open("/dev/zap/pseudo");
- if (p->subs[x].zfd > -1) {
- res = ioctl(p->subs[x].zfd, ZT_GET_BUFINFO, &bi);
- if (!res) {
- bi.txbufpolicy = ZT_POLICY_IMMEDIATE;
- bi.rxbufpolicy = ZT_POLICY_IMMEDIATE;
- bi.numbufs = numbufs;
- res = ioctl(p->subs[x].zfd, ZT_SET_BUFINFO, &bi);
- if (res < 0) {
- ast_log(LOG_WARNING, "Unable to set buffer policy on channel %d\n", x);
- }
- } else
- ast_log(LOG_WARNING, "Unable to check buffer policy on channel %d\n", x);
- if (ioctl(p->subs[x].zfd, ZT_CHANNO, &p->subs[x].chan) == 1) {
- ast_log(LOG_WARNING, "Unable to get channel number for pseudo channel on FD %d\n", p->subs[x].zfd);
- zt_close(p->subs[x].zfd);
- p->subs[x].zfd = -1;
- return -1;
- }
- ast_debug(1, "Allocated %s subchannel on FD %d channel %d\n", subnames[x], p->subs[x].zfd, p->subs[x].chan);
- return 0;
- } else
- ast_log(LOG_WARNING, "Unable to open pseudo channel: %s\n", strerror(errno));
+ ast_log(LOG_WARNING, "%s subchannel of %d already in use\n", subnames[x], p->channel);
return -1;
}
- ast_log(LOG_WARNING, "%s subchannel of %d already in use\n", subnames[x], p->channel);
- return -1;
+
+ p->subs[x].zfd = zt_open("/dev/zap/pseudo");
+ if (p->subs[x].zfd <= -1) {
+ ast_log(LOG_WARNING, "Unable to open pseudo channel: %s\n", strerror(errno));
+ return -1;
+ }
+
+ res = ioctl(p->subs[x].zfd, ZT_GET_BUFINFO, &bi);
+ if (!res) {
+ bi.txbufpolicy = ZT_POLICY_IMMEDIATE;
+ bi.rxbufpolicy = ZT_POLICY_IMMEDIATE;
+ bi.numbufs = numbufs;
+ res = ioctl(p->subs[x].zfd, ZT_SET_BUFINFO, &bi);
+ if (res < 0) {
+ ast_log(LOG_WARNING, "Unable to set buffer policy on channel %d\n", x);
+ }
+ } else
+ ast_log(LOG_WARNING, "Unable to check buffer policy on channel %d\n", x);
+
+ if (ioctl(p->subs[x].zfd, ZT_CHANNO, &p->subs[x].chan) == 1) {
+ ast_log(LOG_WARNING, "Unable to get channel number for pseudo channel on FD %d\n", p->subs[x].zfd);
+ zt_close(p->subs[x].zfd);
+ p->subs[x].zfd = -1;
+ return -1;
+ }
+ ast_debug(1, "Allocated %s subchannel on FD %d channel %d\n", subnames[x], p->subs[x].zfd, p->subs[x].chan);
+ return 0;
}
static int unalloc_sub(struct zt_pvt *p, int x)