Reduce indentation in sig_pri_available().
authorRichard Mudgett <rmudgett@digium.com>
Fri, 25 Sep 2009 19:56:18 +0000 (19:56 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Fri, 25 Sep 2009 19:56:18 +0000 (19:56 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@220543 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/sig_pri.c

index f76113e..652cb39 100644 (file)
@@ -2890,29 +2890,27 @@ int sig_pri_answer(struct sig_pri_chan *p, struct ast_channel *ast)
 int sig_pri_available(struct sig_pri_chan *p, int channelmatch, ast_group_t groupmatch, int *reason, int *channelmatched, int *groupmatched)
 {
        /* If no owner definitely available */
-       if (!p->owner) {
-               /* Trust PRI */
-               if (p->pri) {
+       if (!p->owner && p->pri) {
 #ifdef HAVE_PRI_SERVICE_MESSAGES
-                       char db_chan_name[20], db_answer[5], state;
-                       int why = 0;
+               char db_chan_name[20], db_answer[5], state;
+               int why = 0;
 
-                       snprintf(db_chan_name, sizeof(db_chan_name), "%s/%d:%d", dahdi_db, p->pri->span, p->channel);
-                       if (!ast_db_get(db_chan_name, SRVST_DBKEY, db_answer, sizeof(db_answer))) {
-                               sscanf(db_answer, "%1c:%30d", &state, &why);
+               snprintf(db_chan_name, sizeof(db_chan_name), "%s/%d:%d", dahdi_db, p->pri->span, p->channel);
+               if (!ast_db_get(db_chan_name, SRVST_DBKEY, db_answer, sizeof(db_answer))) {
+                       sscanf(db_answer, "%1c:%30d", &state, &why);
+               }
+               if (p->resetting || p->call || why) {
+                       if (why) {
+                               *reason = AST_CAUSE_REQUESTED_CHAN_UNAVAIL;
                        }
-                       if ((p->resetting || p->call) || (why)) {
-                               if (why) {
-                                       *reason = AST_CAUSE_REQUESTED_CHAN_UNAVAIL;
-                               }
+                       return 0;
+               }
 #else
-                       if (p->resetting || p->call) {
-#endif
-                               return 0;
-                       } else {
-                               return 1;
-                       }
+               if (p->resetting || p->call) {
+                       return 0;
                }
+#endif
+               return 1;
        }
 
        return 0;