get rid of another annoying stray space in the gcc commands
[asterisk/asterisk.git] / autoservice.c
index 08cbb47..c0adc7f 100644 (file)
  * \author Mark Spencer <markster@digium.com> 
  */
 
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
 #include <unistd.h>
 
-#include "asterisk.h"
-
-ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
-
 #include "asterisk/pbx.h"
 #include "asterisk/frame.h"
 #include "asterisk/sched.h"
@@ -107,23 +107,20 @@ int ast_autoservice_start(struct ast_channel *chan)
        /* XXX if found, we return -1, why ??? */
 
        /* If not, start autoservice on channel */
-       if (!as) {
-               as = calloc(1, sizeof(struct asent));
-               if (as) {
-                       as->chan = chan;
-                       AST_LIST_INSERT_HEAD(&aslist, as, list);
-                       res = 0;
-                       if (asthread == AST_PTHREADT_NULL) { /* need start the thread */
-                               if (ast_pthread_create(&asthread, NULL, autoservice_run, NULL)) {
-                                       ast_log(LOG_WARNING, "Unable to create autoservice thread :(\n");
-                                       /* There will only be a single member in the list at this point,
-                                          the one we just added. */
-                                       AST_LIST_REMOVE(&aslist, as, list);
-                                       free(as);
-                                       res = -1;
-                               } else
-                                       pthread_kill(asthread, SIGURG);
-                       }
+       if (!as && (as = ast_calloc(1, sizeof(*as)))) {
+               as->chan = chan;
+               AST_LIST_INSERT_HEAD(&aslist, as, list);
+               res = 0;
+               if (asthread == AST_PTHREADT_NULL) { /* need start the thread */
+                       if (ast_pthread_create(&asthread, NULL, autoservice_run, NULL)) {
+                               ast_log(LOG_WARNING, "Unable to create autoservice thread :(\n");
+                               /* There will only be a single member in the list at this point,
+                                  the one we just added. */
+                               AST_LIST_REMOVE(&aslist, as, list);
+                               free(as);
+                               res = -1;
+                       } else
+                               pthread_kill(asthread, SIGURG);
                }
        }
        AST_LIST_UNLOCK(&aslist);