Remove unused RAII_VAR() declarations.
authorRichard Mudgett <rmudgett@digium.com>
Tue, 15 Apr 2014 18:01:47 +0000 (18:01 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Tue, 15 Apr 2014 18:01:47 +0000 (18:01 +0000)
* Remove unused RAII_VAR() declarations.  The compiler cannot catch these
because the cleanup function "references" the unused variable.  Some
actually allocated and released resources that were never used.

* Fixed some whitespace issues in stasis_bridges.c.
........

Merged revisions 412399 from http://svn.asterisk.org/svn/asterisk/branches/12

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412400 65c4cc65-6c06-0410-ace0-fbb531ad65f3

21 files changed:
channels/chan_oss.c
channels/chan_skinny.c
main/cdr.c
main/pbx.c
main/stasis_bridges.c
main/stasis_channels.c
res/ari/resource_channels.c
res/ari/resource_recordings.c
res/parking/parking_applications.c
res/parking/parking_manager.c
res/res_ari.c
res/res_fax.c
res/res_parking.c
res/res_pjsip/location.c
res/res_pjsip/security_events.c
res/res_pjsip_refer.c
res/res_pjsip_session.c
res/res_stasis_playback.c
res/res_stasis_recording.c
res/stasis/app.c
res/stasis_recording/stored.c

index e5300ef..7fc4f40 100644 (file)
@@ -1175,7 +1175,6 @@ static char *console_mute(struct ast_cli_entry *e, int cmd, struct ast_cli_args
 static char *console_transfer(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
        struct chan_oss_pvt *o = find_desc(oss_active);
-       RAII_VAR(struct ast_channel *, b, NULL, ast_channel_cleanup);
        char *tmp, *ext, *ctx;
 
        switch (cmd) {
index cf0b072..8ed469e 100644 (file)
@@ -7202,8 +7202,6 @@ static int handle_soft_key_event_message(struct skinny_req *req, struct skinnyse
                }
 
                if ((sub && sub->owner) && (ast_channel_state(sub->owner) ==  AST_STATE_UP)) {
-                       RAII_VAR(struct ast_channel *, bridged, NULL, ast_channel_cleanup);
-
                        c = sub->owner;
                        ast_channel_lock(c);
                        bridge_channel = ast_channel_get_bridge_channel(c);
index 4679690..1828b0a 100644 (file)
@@ -1085,7 +1085,6 @@ static struct ast_cdr *cdr_object_create_public_records(struct cdr_object *cdr)
        struct ast_var_t *it_var, *it_copy_var;
        struct ast_channel_snapshot *party_a;
        struct ast_channel_snapshot *party_b;
-       RAII_VAR(struct module_config *, mod_cfg, ao2_global_obj_ref(module_configs), ao2_cleanup);
 
        for (it_cdr = cdr; it_cdr; it_cdr = it_cdr->next) {
                struct ast_cdr *cdr_copy;
@@ -1239,9 +1238,6 @@ static void cdr_object_set_disposition(struct cdr_object *cdr, int hangupcause)
  */
 static void cdr_object_finalize(struct cdr_object *cdr)
 {
-       RAII_VAR(struct module_config *, mod_cfg,
-                       ao2_global_obj_ref(module_configs), ao2_cleanup);
-
        if (!ast_tvzero(cdr->end)) {
                return;
        }
@@ -1644,8 +1640,6 @@ static enum ast_cdr_disposition dial_status_to_disposition(const char *dial_stat
 
 static int dial_state_process_dial_end(struct cdr_object *cdr, struct ast_channel_snapshot *caller, struct ast_channel_snapshot *peer, const char *dial_status)
 {
-       RAII_VAR(struct module_config *, mod_cfg,
-                       ao2_global_obj_ref(module_configs), ao2_cleanup);
        struct ast_channel_snapshot *party_a;
 
        if (caller) {
index b24bcd8..d161117 100644 (file)
@@ -4834,8 +4834,6 @@ static int pbx_extension_helper(struct ast_channel *c, struct ast_context *con,
        struct pbx_find_info q = { .stacklen = 0 }; /* the rest is reset in pbx_find_extension */
        char passdata[EXT_DATA_SIZE];
        int matching_action = (action == E_MATCH || action == E_CANMATCH || action == E_MATCHMORE);
-       RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup);
-       RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup);
 
        ast_rdlock_contexts();
        if (found)
index eb02016..1e0b36e 100644 (file)
@@ -346,11 +346,11 @@ static struct ast_json *ast_bridge_merge_message_to_json(
                return NULL;
        }
 
-        return ast_json_pack("{s: s, s: o, s: O, s: O}",
-                "type", "BridgeMerged",
-                "timestamp", ast_json_timeval(*stasis_message_timestamp(msg), NULL),
-                "bridge", json_bridge_to,
-                "bridge_from", json_bridge_from);
+       return ast_json_pack("{s: s, s: o, s: O, s: O}",
+               "type", "BridgeMerged",
+               "timestamp", ast_json_timeval(*stasis_message_timestamp(msg), NULL),
+               "bridge", json_bridge_to,
+               "bridge_from", json_bridge_from);
 }
 
 void ast_bridge_publish_merge(struct ast_bridge *to, struct ast_bridge *from)
@@ -466,10 +466,10 @@ void ast_bridge_publish_leave(struct ast_bridge *bridge, struct ast_channel *cha
 }
 
 static struct ast_json *simple_bridge_channel_event(
-        const char *type,
-        struct ast_bridge_snapshot *bridge_snapshot,
-        struct ast_channel_snapshot *channel_snapshot,
-        const struct timeval *tv,
+       const char *type,
+       struct ast_bridge_snapshot *bridge_snapshot,
+       struct ast_channel_snapshot *channel_snapshot,
+       const struct timeval *tv,
        const struct stasis_message_sanitizer *sanitize)
 {
        RAII_VAR(struct ast_json *, json_bridge,
@@ -481,31 +481,31 @@ static struct ast_json *simple_bridge_channel_event(
                return NULL;
        }
 
-        return ast_json_pack("{s: s, s: o, s: O, s: O}",
-                "type", type,
-                "timestamp", ast_json_timeval(*tv, NULL),
-                "bridge", json_bridge,
-                "channel", json_channel);
+       return ast_json_pack("{s: s, s: o, s: O, s: O}",
+               "type", type,
+               "timestamp", ast_json_timeval(*tv, NULL),
+               "bridge", json_bridge,
+               "channel", json_channel);
 }
 
 struct ast_json *ast_channel_entered_bridge_to_json(
        struct stasis_message *msg,
        const struct stasis_message_sanitizer *sanitize)
 {
-        struct ast_bridge_blob *obj = stasis_message_data(msg);
+       struct ast_bridge_blob *obj = stasis_message_data(msg);
 
        return simple_bridge_channel_event("ChannelEnteredBridge", obj->bridge,
-                obj->channel, stasis_message_timestamp(msg), sanitize);
+               obj->channel, stasis_message_timestamp(msg), sanitize);
 }
 
 struct ast_json *ast_channel_left_bridge_to_json(
        struct stasis_message *msg,
        const struct stasis_message_sanitizer *sanitize)
 {
-        struct ast_bridge_blob *obj = stasis_message_data(msg);
+       struct ast_bridge_blob *obj = stasis_message_data(msg);
 
        return simple_bridge_channel_event("ChannelLeftBridge", obj->bridge,
-                obj->channel, stasis_message_timestamp(msg), sanitize);
+               obj->channel, stasis_message_timestamp(msg), sanitize);
 }
 
 static struct ast_json *container_to_json_array(struct ao2_container *items,
index 45ec53d..c75d174 100644 (file)
@@ -716,7 +716,6 @@ static struct ast_manager_event_blob *varset_to_ami(struct stasis_message *msg)
 static struct ast_manager_event_blob *agent_login_to_ami(struct stasis_message *msg)
 {
        RAII_VAR(struct ast_str *, channel_string, NULL, ast_free);
-       RAII_VAR(struct ast_str *, party_string, ast_str_create(256), ast_free);
        struct ast_channel_blob *obj = stasis_message_data(msg);
        const char *agent = ast_json_string_get(ast_json_object_get(obj->blob, "agent"));
 
@@ -734,7 +733,6 @@ static struct ast_manager_event_blob *agent_login_to_ami(struct stasis_message *
 static struct ast_manager_event_blob *agent_logoff_to_ami(struct stasis_message *msg)
 {
        RAII_VAR(struct ast_str *, channel_string, NULL, ast_free);
-       RAII_VAR(struct ast_str *, party_string, ast_str_create(256), ast_free);
        struct ast_channel_blob *obj = stasis_message_data(msg);
        const char *agent = ast_json_string_get(ast_json_object_get(obj->blob, "agent"));
        long logintime = ast_json_integer_get(ast_json_object_get(obj->blob, "logintime"));
index 7b7e807..9d127b2 100644 (file)
@@ -464,7 +464,6 @@ void ast_ari_channels_record(struct ast_variable *headers,
        struct ast_ari_response *response)
 {
        RAII_VAR(struct stasis_app_control *, control, NULL, ao2_cleanup);
-       RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup);
        RAII_VAR(struct stasis_app_recording *, recording, NULL, ao2_cleanup);
        RAII_VAR(char *, recording_url, NULL, ast_free);
        struct ast_json *json;
index abde4f0..bc07d55 100644 (file)
@@ -166,7 +166,6 @@ static void control_recording(const char *name,
        struct ast_ari_response *response)
 {
        RAII_VAR(struct stasis_app_recording *, recording, NULL, ao2_cleanup);
-       RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);
        enum stasis_app_recording_oper_results res;
 
        recording = stasis_app_recording_find_by_name(name);
index 85075bc..3d2eecd 100644 (file)
@@ -553,7 +553,6 @@ static int parked_call_app_exec(struct ast_channel *chan, const char *data)
 {
        RAII_VAR(struct parking_lot *, lot, NULL, ao2_cleanup);
        RAII_VAR(struct parked_user *, pu, NULL, ao2_cleanup); /* Parked user being retrieved */
-       RAII_VAR(struct ast_bridge *, parking_bridge, NULL, ao2_cleanup);
        struct ast_bridge *retrieval_bridge;
        int res;
        int target_space = -1;
index 70a230c..16e2863 100644 (file)
@@ -152,7 +152,6 @@ static struct stasis_subscription *parking_sub;
 
 static struct ast_parked_call_payload *parked_call_payload_from_failure(struct ast_channel *chan)
 {
-       RAII_VAR(struct ast_parked_call_payload *, payload, NULL, ao2_cleanup);
        RAII_VAR(struct ast_channel_snapshot *, parkee_snapshot, NULL, ao2_cleanup);
 
        ast_channel_lock(chan);
@@ -167,7 +166,6 @@ static struct ast_parked_call_payload *parked_call_payload_from_failure(struct a
 
 static struct ast_parked_call_payload *parked_call_payload_from_parked_user(struct parked_user *pu, enum ast_parked_call_event_type event_type)
 {
-       RAII_VAR(struct ast_parked_call_payload *, payload, NULL, ao2_cleanup);
        RAII_VAR(struct ast_channel_snapshot *, parkee_snapshot, NULL, ao2_cleanup);
        long int timeout;
        long int duration;
@@ -177,7 +175,6 @@ static struct ast_parked_call_payload *parked_call_payload_from_parked_user(stru
        ast_channel_lock(pu->chan);
        parkee_snapshot = ast_channel_snapshot_create(pu->chan);
        ast_channel_unlock(pu->chan);
-
        if (!parkee_snapshot) {
                return NULL;
        }
index 133ca66..4f16c02 100644 (file)
@@ -472,7 +472,6 @@ void ast_ari_invoke(struct ast_tcptls_session_instance *ser,
        struct ast_variable *get_params, struct ast_variable *headers,
        struct ast_ari_response *response)
 {
-       RAII_VAR(char *, response_text, NULL, ast_free);
        RAII_VAR(struct stasis_rest_handlers *, root, NULL, ao2_cleanup);
        struct stasis_rest_handlers *handler;
        RAII_VAR(struct ast_variable *, path_vars, NULL, ast_variables_destroy);
index e05b101..4f253b7 100644 (file)
@@ -1175,7 +1175,6 @@ static char *generate_filenames_string(struct ast_fax_session_details *details,
 static int report_fax_status(struct ast_channel *chan, struct ast_fax_session_details *details, const char *status)
 {
        RAII_VAR(struct ast_json *, json_object, NULL, ast_json_unref);
-       RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup);
        RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
        struct ast_json *json_filenames = NULL;
 
index 6d07818..c36d558 100644 (file)
@@ -689,7 +689,6 @@ static int parking_add_extension(struct ast_context *context, int replace, const
 
 static int extension_is_compatible(struct parking_lot_cfg *lot_cfg, const char *app_type, struct ast_exten *extension)
 {
-       RAII_VAR(struct parking_lot_cfg *, owner, NULL, ao2_cleanup);
        const char *extension_registrar = ast_get_extension_registrar(extension);
        const char *extension_context = ast_get_context_name(ast_get_extension_context(extension));
        const char *extension_name = ast_get_extension_name(extension);
index e526c46..2cd852d 100644 (file)
@@ -158,7 +158,6 @@ struct ast_sip_contact *ast_sip_location_retrieve_contact_from_aor_list(const ch
 
        while ((aor_name = strsep(&rest, ","))) {
                RAII_VAR(struct ast_sip_aor *, aor, ast_sip_location_retrieve_aor(aor_name), ao2_cleanup);
-               RAII_VAR(struct ao2_container *, contacts, NULL, ao2_cleanup);
 
                if (!aor) {
                        continue;
index 5bb5af9..5c30e1c 100644 (file)
@@ -136,7 +136,6 @@ void ast_sip_report_auth_failed_challenge_response(struct ast_sip_endpoint *endp
        char call_id[pj_strlen(&rdata->msg_info.cid->id) + 1];
        char nonce[64] = "", response[256] = "";
        struct ast_sockaddr local, remote;
-       RAII_VAR(struct ast_sip_endpoint *, artificial, ast_sip_get_artificial_endpoint(), ao2_cleanup);
 
        struct ast_security_event_chal_resp_failed chal_resp_failed = {
                                .common.event_type = AST_SECURITY_EVENT_CHAL_RESP_FAILED,
index 399e9e6..9725caa 100644 (file)
@@ -732,7 +732,6 @@ static int refer_incoming_invite_request(struct ast_sip_session *session, struct
        int response = 0;
        RAII_VAR(struct ast_sip_session *, other_session, NULL, ao2_cleanup);
        struct invite_replaces invite;
-       RAII_VAR(struct ast_bridge *, bridge, NULL, ao2_cleanup);
 
        /* If a Replaces header is present make sure it is valid */
        if (pjsip_replaces_verify_request(rdata, &other_dlg, PJ_TRUE, &packet) != PJ_SUCCESS) {
index 067bf87..82c7a3f 100644 (file)
@@ -302,7 +302,7 @@ static int validate_incoming_sdp(const pjmedia_sdp_session *sdp)
        for (i = 0; i < sdp->media_count; ++i) {
                RAII_VAR(int *, port, ao2_alloc(sizeof(int), NULL), ao2_cleanup);
                RAII_VAR(int *, port_match, NULL, ao2_cleanup);
-               RAII_VAR(int *, bundle_match, NULL, ao2_cleanup);
+
                *port = sdp->media[i]->desc.port;
                port_match = ao2_find(portlist, port, OBJ_KEY);
                if (port_match) {
index 299cb44..79c2bab 100644 (file)
@@ -192,7 +192,6 @@ static const char *state_to_string(enum stasis_app_playback_state state)
 static void playback_publish(struct stasis_app_playback *playback)
 {
        RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);
-       RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup);
        RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
 
        ast_assert(playback != NULL);
index 080ee7b..a256fe9 100644 (file)
@@ -211,7 +211,6 @@ enum ast_record_if_exists stasis_app_recording_if_exists_parse(
 static void recording_publish(struct stasis_app_recording *recording, const char *cause)
 {
        RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);
-       RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup);
        RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
 
        ast_assert(recording != NULL);
index 54ee589..d9eef4c 100644 (file)
@@ -387,7 +387,6 @@ static struct ast_json *channel_dialplan(
        struct ast_channel_snapshot *new_snapshot,
        const struct timeval *tv)
 {
-       RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);
        struct ast_json *json_channel;
 
        /* No Newexten event on cache clear or first event */
@@ -422,7 +421,6 @@ static struct ast_json *channel_callerid(
        struct ast_channel_snapshot *new_snapshot,
        const struct timeval *tv)
 {
-       RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);
        struct ast_json *json_channel;
 
        /* No NewCallerid event on cache clear or first event */
index 255976d..03af069 100644 (file)
@@ -247,7 +247,6 @@ static int scan_file(struct ao2_container *recordings,
 {
        RAII_VAR(struct stasis_app_stored_recording *, recording, NULL,
                ao2_cleanup);
-       RAII_VAR(struct ast_str *, name, NULL, ast_free);
        const char *ext;
        char *dot;