From: Andrey Volk Date: Mon, 25 May 2026 20:56:13 +0000 (+0300) Subject: [Core, modules] Fix various dead assignments. X-Git-Tag: v1.11.1^2~18 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1544dfb755ef0fd3b3611ad96a016af3f08fc39b;p=thirdparty%2Ffreeswitch.git [Core, modules] Fix various dead assignments. --- diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 75b79b2ebf..22e25ea8a6 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -549,7 +549,7 @@ SWITCH_STANDARD_API(reg_url_function) char *domain = NULL, *dup_domain = NULL; char *concat = NULL; const char *exclude_contact = NULL; - char *reply = "error/facility_not_subscribed"; + char *reply; switch_stream_handle_t mystream = { 0 }; if (!cmd) { @@ -2324,7 +2324,7 @@ SWITCH_STANDARD_API(status_function) int sps = 0, last_sps = 0, max_sps = 0, max_sps_fivemin = 0; int sessions_peak = 0, sessions_peak_fivemin = 0; /* Max Concurrent Sessions buffers */ switch_bool_t html = SWITCH_FALSE; /* shortcut to format.html */ - char * nl = "\n"; /* shortcut to format.nl */ + char *nl; /* shortcut to format.nl */ stream_format format = { 0 }; switch_size_t cur = 0, max = 0; @@ -7523,7 +7523,7 @@ SWITCH_STANDARD_JSON_API(json_status_function) SWITCH_STANDARD_API(json_function) { cJSON *jcmd = NULL, *format = NULL; - const char *message = ""; + const char *message; char *response = NULL; if (zstr(cmd)) { diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index aa606170d5..4f0374263d 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -1911,8 +1911,8 @@ SWITCH_STANDARD_APP(conference_function) member_flag_t mflags[MFLAG_MAX] = { 0 }; switch_core_session_message_t msg = { 0 }; uint8_t isbr = 0; - char *dpin = ""; - const char *mdpin = ""; + char *dpin; + const char *mdpin; conference_xml_cfg_t xml_cfg = { 0 }; switch_event_t *params = NULL; int locked = 0; diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 8c8d0103c4..0767315c92 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -562,7 +562,7 @@ static void phase_e_handler(void *user_data, int result) switch_event_t *event; const char *var; char *expanded; - const char *fax_result_str = ""; + const char *fax_result_str; pvt = (pvt_t *) user_data; switch_assert(pvt); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 086d6dd088..4fd5d57c1f 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -4091,7 +4091,7 @@ SWITCH_STANDARD_API(sofia_contact_function) sofia_profile_t *profile = NULL; const char *exclude_contact = NULL; const char *match_user_agent = NULL; - char *reply = "error/facility_not_subscribed"; + char *reply; switch_stream_handle_t mystream = { 0 }; if (!cmd) { diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index d2e94f16ce..2901ffdd63 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1210,7 +1210,7 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro switch_channel_t *channel = switch_core_session_get_channel(session); sip_p_asserted_identity_t *passerted = NULL; char *name = NULL; - const char *number = "unknown", *tmp; + const char *number, *tmp; switch_caller_profile_t *caller_profile; char *dup = NULL; switch_event_t *event; @@ -7535,7 +7535,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, } if (channel && profile->pres_type && ss_state == nua_callstate_ready && status == 200) { - const char* to_tag = ""; + const char* to_tag; char *sql = NULL; to_tag = switch_str_nil(switch_channel_get_variable(channel, "sip_to_tag")); sql = switch_mprintf("update sip_dialogs set sip_to_tag='%q' " @@ -10392,7 +10392,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia nua_handle_t *bnh = NULL; char sip_acl_authed_by[512] = ""; char sip_acl_token[512] = ""; - const char *dialog_from_user = "", *dialog_from_host = "", *to_user = "", *to_host = "", *contact_user = "", *contact_host = ""; + const char *dialog_from_user = "", *dialog_from_host = "", *to_user = "", *to_host = "", *contact_user, *contact_host; const char *user_agent = "", *call_id = ""; url_t *from = NULL, *to = NULL, *contact = NULL; const char *to_tag = ""; @@ -11635,7 +11635,7 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia if (profile->pres_type) { const char *presence_data = switch_channel_get_variable(channel, "presence_data"); const char *presence_id = switch_channel_get_variable(channel, "presence_id"); - char *full_contact = ""; + char *full_contact; char *p = NULL; time_t now; diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 33904aaac4..d490ebd65c 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1038,7 +1038,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) switch_caller_profile_t *caller_profile; const char *cid_name, *cid_num; char *e_dest = NULL; - const char *holdstr = ""; + const char *holdstr; char *extra_headers = NULL; switch_status_t status = SWITCH_STATUS_FALSE; uint32_t session_timeout = tech_pvt->profile->session_timeout; @@ -3334,7 +3334,7 @@ char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, nua const char *contact_host;//, *contact_user; sip_contact_t const *contact; char *port; - const char *display = "\"user\""; + const char *display; char new_port[25] = ""; sofia_nat_parse_t lnp = { { 0 } }; const char *ipv6; diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 151d6ec634..6108cc5a6a 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -2392,7 +2392,7 @@ static int sofia_dialog_probe_notify_callback(void *pArg, int argc, char **argv, switch_stream_handle_t stream = { 0 }; char *to; const char *pl = NULL; - const char *ct = "application/dialog-info+xml"; + const char *ct; if (mod_sofia_globals.debug_presence > 0) { int i; @@ -3659,7 +3659,7 @@ void sofia_presence_handle_sip_i_subscribe(int status, char *orig_proto = ""; char *alt_proto = NULL; char *d_user = NULL; - char *contact_str = ""; + char *contact_str; const char *call_id = NULL; char *to_str = NULL; char *full_from = NULL; diff --git a/src/mod/endpoints/mod_verto/mod_verto.c b/src/mod/endpoints/mod_verto/mod_verto.c index 40bb51171a..1363416139 100644 --- a/src/mod/endpoints/mod_verto/mod_verto.c +++ b/src/mod/endpoints/mod_verto/mod_verto.c @@ -174,7 +174,7 @@ void verto_broadcast(const char *event_channel, cJSON *json, const char *key, sw static int verto_init_ssl(verto_profile_t *profile) { - const char *err = ""; + const char *err; int i = 0; profile->ssl_method = SSLv23_server_method(); /* create server instance */ diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index 1c35b6f049..31bac3305b 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -1117,7 +1117,7 @@ SWITCH_STANDARD_API(event_sink_function) } if (listener->format == EVENT_FORMAT_JSON) { - char *p = "{}"; + char *p; cJSON_AddItemToObject(cj, "events", cjevents); p = cJSON_Print(cj); if (cj && p) stream->write_function(stream, p); diff --git a/src/mod/formats/mod_shout/mod_shout.c b/src/mod/formats/mod_shout/mod_shout.c index d6cad23bbd..5cc54a4f1a 100644 --- a/src/mod/formats/mod_shout/mod_shout.c +++ b/src/mod/formats/mod_shout/mod_shout.c @@ -1289,7 +1289,7 @@ void do_telecast(switch_stream_handle_t *stream) char *path_info = switch_event_get_header(stream->param_event, "http-path-info"); char *uuid = strdup(path_info + 4); switch_core_session_t *tsession; - char *fname = "stream.mp3"; + char *fname; switch_assert(uuid); if ((fname = strchr(uuid, '/'))) { diff --git a/src/mod/languages/mod_python3/freeswitch_python.cpp b/src/mod/languages/mod_python3/freeswitch_python.cpp index e35c7ed464..600d8f87df 100644 --- a/src/mod/languages/mod_python3/freeswitch_python.cpp +++ b/src/mod/languages/mod_python3/freeswitch_python.cpp @@ -293,7 +293,7 @@ switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t ityp PyObject *pyresult, *arglist, *io = NULL; int ts = 0; - char *str = NULL, *what = (char*)""; + char *str = NULL, *what; if (TS) { ts++; diff --git a/src/mod/languages/mod_v8/mod_v8.cpp b/src/mod/languages/mod_v8/mod_v8.cpp index b297fa39e1..96ac67f2f6 100644 --- a/src/mod/languages/mod_v8/mod_v8.cpp +++ b/src/mod/languages/mod_v8/mod_v8.cpp @@ -424,7 +424,7 @@ static void v8_error(Isolate* isolate, TryCatch* try_catch) String::Utf8Value exception(try_catch->Exception()); const char *exception_string = js_safe_str(*exception); Handle message = try_catch->Message(); - const char *msg = ""; + const char *msg; string filename = __FILE__; int line = __LINE__; string text = ""; diff --git a/src/switch_core_media.c b/src/switch_core_media.c index de5d0eff74..51a4d32604 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -4549,7 +4549,7 @@ static void restore_pmaps(switch_rtp_engine_t *engine) static const char *media_flow_varname(switch_media_type_t type) { - const char *varname = "invalid"; + const char *varname; switch(type) { case SWITCH_MEDIA_TYPE_AUDIO: @@ -4561,6 +4561,9 @@ static const char *media_flow_varname(switch_media_type_t type) case SWITCH_MEDIA_TYPE_TEXT: varname = "text_media_flow"; break; + default: + varname = "invalid"; + break; } return varname; @@ -4568,7 +4571,7 @@ static const char *media_flow_varname(switch_media_type_t type) static const char *remote_media_flow_varname(switch_media_type_t type) { - const char *varname = "invalid"; + const char *varname; switch(type) { case SWITCH_MEDIA_TYPE_AUDIO: @@ -4580,6 +4583,9 @@ static const char *remote_media_flow_varname(switch_media_type_t type) case SWITCH_MEDIA_TYPE_TEXT: varname = "remote_text_media_flow"; break; + default: + varname = "invalid"; + break; } return varname; @@ -4587,7 +4593,7 @@ static const char *remote_media_flow_varname(switch_media_type_t type) static void media_flow_get_mode(switch_media_flow_t smode, const char **mode_str, switch_media_flow_t *opp_mode) { - const char *smode_str = ""; + const char *smode_str; switch_media_flow_t opp_smode = smode; switch(smode) { @@ -4608,6 +4614,9 @@ static void media_flow_get_mode(switch_media_flow_t smode, const char **mode_str case SWITCH_MEDIA_FLOW_SENDRECV: smode_str = "sendrecv"; break; + default: + smode_str = ""; + break; } *mode_str = smode_str; @@ -11775,7 +11784,7 @@ SWITCH_DECLARE(void) switch_core_media_set_udptl_image_sdp(switch_core_session_t char max_data[128] = ""; const char *ip; uint32_t port; - const char *family = "IP4"; + const char *family; const char *username; const char *bit_removal_on = "a=T38FaxFillBitRemoval\r\n"; const char *bit_removal_off = ""; @@ -12033,7 +12042,7 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session) switch_size_t len; if (oe) { - const char *family = "IP4"; + const char *family; char o_line[1024] = ""; if (oe >= pe) { diff --git a/src/switch_msrp.c b/src/switch_msrp.c index 9fd84d846b..89b2a886c6 100644 --- a/src/switch_msrp.c +++ b/src/switch_msrp.c @@ -114,7 +114,7 @@ static void msrp_deinit_ssl(void) static void msrp_init_ssl(void) { - const char *err = ""; + const char *err; globals.ssl_client_method = SSLv23_client_method(); globals.ssl_client_ctx = SSL_CTX_new(globals.ssl_client_method); diff --git a/src/switch_rtp.c b/src/switch_rtp.c index d038566d90..d92b23001e 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -3822,7 +3822,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d switch_dtls_t *dtls; const char *var; int ret; - const char *kind = ""; + const char *kind; unsigned long ssl_method_error = 0; unsigned long ssl_ctx_error = 0; const SSL_METHOD *ssl_method;