Skip to content
This repository has been archived by the owner on Jan 14, 2020. It is now read-only.

Commit

Permalink
Remove unused RAII_VAR() declarations.
Browse files Browse the repository at this point in the history
* 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: http://svn.asterisk.org/svn/asterisk/trunk@412400 f38db490-d61c-443f-a65b-d21fe96a405b
  • Loading branch information
rmudgett9125 committed Apr 15, 2014
1 parent 927db85 commit 0ea6000
Show file tree
Hide file tree
Showing 21 changed files with 19 additions and 49 deletions.
1 change: 0 additions & 1 deletion channels/chan_oss.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 0 additions & 2 deletions channels/chan_skinny.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 0 additions & 6 deletions main/cdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 0 additions & 2 deletions main/pbx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
36 changes: 18 additions & 18 deletions main/stasis_bridges.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions main/stasis_channels.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"));

Expand All @@ -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"));
Expand Down
1 change: 0 additions & 1 deletion res/ari/resource_channels.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion res/ari/resource_recordings.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion res/parking/parking_applications.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 0 additions & 3 deletions res/parking/parking_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand All @@ -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;
}
Expand Down
1 change: 0 additions & 1 deletion res/res_ari.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion res/res_fax.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion res/res_parking.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion res/res_pjsip/location.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion res/res_pjsip/security_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion res/res_pjsip_refer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion res/res_pjsip_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion res/res_stasis_playback.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion res/res_stasis_recording.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions res/stasis/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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 */
Expand Down
1 change: 0 additions & 1 deletion res/stasis_recording/stored.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 0ea6000

Please sign in to comment.