Just some minor coding style cleanup...
[asterisk/asterisk.git] / main / indications.c
index 61f3328..2bb3e44 100644 (file)
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 #include <math.h>
 
 #include "asterisk/lock.h"
 #include "asterisk/linkedlists.h"
 #include "asterisk/indications.h"
 #include "asterisk/frame.h"
-#include "asterisk/options.h"
 #include "asterisk/channel.h"
-#include "asterisk/logger.h"
 #include "asterisk/utils.h"
 
 static int midi_tohz[128] = {
@@ -170,7 +165,7 @@ static int playtones_generator(struct ast_channel *chan, void *data, int len, in
                ps->v3_2 = pi->init_v3_2;
                ps->oldnpos = ps->npos;
        }
-       for (x=0;x<len/2;x++) {
+       for (x = 0; x < len/2; x++) {
                ps->v1_1 = ps->v2_1;
                ps->v2_1 = ps->v3_1;
                ps->v3_1 = (pi->fac1 * ps->v2_1 >> 15) - ps->v1_1;
@@ -238,7 +233,7 @@ int ast_playtones_start(struct ast_channel *chan, int vol, const char *playlst,
                separator = ",";
        s = strsep(&stringp,separator);
        while (s && *s) {
-               int freq1, freq2, time, modulate=0, midinote=0;
+               int freq1, freq2, time, modulate = 0, midinote = 0;
 
                if (s[0]=='!')
                        s++;
@@ -480,12 +475,12 @@ int ast_register_indication_country(struct ind_tone_zone *zone)
                if (tz == current_tonezone)
                        current_tonezone = zone;
                /* Remove from the linked list */
-               AST_RWLIST_REMOVE_CURRENT(&tone_zones, list);
+               AST_RWLIST_REMOVE_CURRENT(list);
                /* Finally free the zone itself */
                free_zone(tz);
                break;
        }
-       AST_RWLIST_TRAVERSE_SAFE_END
+       AST_RWLIST_TRAVERSE_SAFE_END;
 
        /* Add zone to the list */
        AST_RWLIST_INSERT_TAIL(&tone_zones, zone, list);
@@ -515,12 +510,12 @@ int ast_unregister_indication_country(const char *country)
                        current_tonezone = NULL;
                }
                /* Remove from the list */
-               AST_RWLIST_REMOVE_CURRENT(&tone_zones, list);
+               AST_RWLIST_REMOVE_CURRENT(list);
                ast_verb(3, "Unregistered indication country '%s'\n", tz->country);
                free_zone(tz);
                res = 0;
        }
-       AST_RWLIST_TRAVERSE_SAFE_END
+       AST_RWLIST_TRAVERSE_SAFE_END;
        AST_RWLIST_UNLOCK(&tone_zones);
 
        return res;
@@ -538,7 +533,7 @@ int ast_register_indication(struct ind_tone_zone *zone, const char *indication,
 
        AST_RWLIST_WRLOCK(&tone_zones);
        for (ps=NULL,ts=zone->tones; ts; ps=ts,ts=ts->next) {
-               if (strcasecmp(indication,ts->name)==0) {
+               if (!strcasecmp(indication,ts->name)) {
                        /* indication already there, replace */
                        ast_free((void*)ts->name);
                        ast_free((void*)ts->data);
@@ -578,7 +573,7 @@ int ast_unregister_indication(struct ind_tone_zone *zone, const char *indication
        AST_RWLIST_WRLOCK(&tone_zones);
        ts = zone->tones;
        while (ts) {
-               if (strcasecmp(indication,ts->name)==0) {
+               if (!strcasecmp(indication,ts->name)) {
                        /* indication found */
                        tmp = ts->next;
                        if (ps)