mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
cmd_url_*(): remove NULLing when not needed
This commit is contained in:
parent
780ee74177
commit
2fc5a2ee54
@ -8955,8 +8955,6 @@ cmd_url_open(ProfWin *window, const char *const command, gchar **args)
|
|||||||
|
|
||||||
gboolean require_save = false;
|
gboolean require_save = false;
|
||||||
|
|
||||||
char *suffix_cmd = NULL;
|
|
||||||
char *suffix = NULL;
|
|
||||||
gchar *fileStart = g_strrstr(args[1], "/");
|
gchar *fileStart = g_strrstr(args[1], "/");
|
||||||
if (fileStart == NULL) {
|
if (fileStart == NULL) {
|
||||||
cons_show("URL '%s' is not valid.", args[1]);
|
cons_show("URL '%s' is not valid.", args[1]);
|
||||||
@ -8972,6 +8970,8 @@ cmd_url_open(ProfWin *window, const char *const command, gchar **args)
|
|||||||
// fileStart is set to the end of the URL.
|
// fileStart is set to the end of the URL.
|
||||||
fileStart = args[1] + strlen(args[1]);
|
fileStart = args[1] + strlen(args[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gchar *suffix = NULL;
|
||||||
gchar *suffixStart = g_strrstr(fileStart, ".");
|
gchar *suffixStart = g_strrstr(fileStart, ".");
|
||||||
if (suffixStart != NULL) {
|
if (suffixStart != NULL) {
|
||||||
suffixStart++;
|
suffixStart++;
|
||||||
@ -8989,17 +8989,15 @@ cmd_url_open(ProfWin *window, const char *const command, gchar **args)
|
|||||||
g_strfreev(suffix_cmd_pref);
|
g_strfreev(suffix_cmd_pref);
|
||||||
suffix_cmd_pref = prefs_get_string_list_with_option(PREF_URL_OPEN_CMD, lowercase_suffix);
|
suffix_cmd_pref = prefs_get_string_list_with_option(PREF_URL_OPEN_CMD, lowercase_suffix);
|
||||||
g_free(lowercase_suffix);
|
g_free(lowercase_suffix);
|
||||||
lowercase_suffix = NULL;
|
|
||||||
g_free(suffix);
|
g_free(suffix);
|
||||||
suffix = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 == g_strcmp0(suffix_cmd_pref[0], "true")) {
|
if (0 == g_strcmp0(suffix_cmd_pref[0], "true")) {
|
||||||
require_save = true;
|
require_save = true;
|
||||||
}
|
}
|
||||||
suffix_cmd = g_strdup(suffix_cmd_pref[1]);
|
|
||||||
|
gchar *suffix_cmd = g_strdup(suffix_cmd_pref[1]);
|
||||||
g_strfreev(suffix_cmd_pref);
|
g_strfreev(suffix_cmd_pref);
|
||||||
suffix_cmd_pref = NULL;
|
|
||||||
|
|
||||||
gchar *scheme = g_uri_parse_scheme(args[1]);
|
gchar *scheme = g_uri_parse_scheme(args[1]);
|
||||||
if( 0 == g_strcmp0(scheme, "aesgcm")) {
|
if( 0 == g_strcmp0(scheme, "aesgcm")) {
|
||||||
@ -9118,11 +9116,9 @@ cmd_url_save(ProfWin *window, const char *const command, gchar **args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_free(scheme);
|
g_free(scheme);
|
||||||
scheme = NULL;
|
|
||||||
|
|
||||||
gchar **argv = g_strsplit(scheme_cmd, " ", 0);
|
gchar **argv = g_strsplit(scheme_cmd, " ", 0);
|
||||||
g_free(scheme_cmd);
|
g_free(scheme_cmd);
|
||||||
scheme_cmd = NULL;
|
|
||||||
|
|
||||||
guint num_args = 0;
|
guint num_args = 0;
|
||||||
while (argv[num_args]) {
|
while (argv[num_args]) {
|
||||||
|
Loading…
Reference in New Issue
Block a user