summaryrefslogtreecommitdiff
path: root/src/plugins/script
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/script')
-rw-r--r--src/plugins/script/script-action.c3
-rw-r--r--src/plugins/script/script-completion.c3
-rw-r--r--src/plugins/script/script-config.c3
-rw-r--r--src/plugins/script/script-repo.c87
4 files changed, 32 insertions, 64 deletions
diff --git a/src/plugins/script/script-action.c b/src/plugins/script/script-action.c
index 449a337fb..e270a488f 100644
--- a/src/plugins/script/script-action.c
+++ b/src/plugins/script/script-action.c
@@ -488,8 +488,7 @@ script_action_run_autoload (const char *name, int quiet, int autoload)
free (filename);
}
- if (weechat_data_dir)
- free (weechat_data_dir);
+ free (weechat_data_dir);
if (!script_found)
{
diff --git a/src/plugins/script/script-completion.c b/src/plugins/script/script-completion.c
index 504de561c..ee73fcf5e 100644
--- a/src/plugins/script/script-completion.c
+++ b/src/plugins/script/script-completion.c
@@ -227,8 +227,7 @@ script_completion_scripts_files_cb (const void *pointer, void *data,
free (directory);
}
- if (weechat_data_dir)
- free (weechat_data_dir);
+ free (weechat_data_dir);
return WEECHAT_RC_OK;
}
diff --git a/src/plugins/script/script-config.c b/src/plugins/script/script-config.c
index f47d333fd..80fa7fbe2 100644
--- a/src/plugins/script/script-config.c
+++ b/src/plugins/script/script-config.c
@@ -143,8 +143,7 @@ script_config_get_diff_command ()
weechat_string_free_split (paths);
}
}
- if (dir_separator)
- free (dir_separator);
+ free (dir_separator);
if (!result[0])
snprintf (result, sizeof (result), "diff");
return result;
diff --git a/src/plugins/script/script-repo.c b/src/plugins/script/script-repo.c
index fc6f5655e..657ebbced 100644
--- a/src/plugins/script/script-repo.c
+++ b/src/plugins/script/script-repo.c
@@ -180,8 +180,7 @@ script_repo_get_filename_loaded (struct t_script_repo *script)
filename = malloc (length);
if (!filename)
{
- if (weechat_data_dir)
- free (weechat_data_dir);
+ free (weechat_data_dir);
return NULL;
}
@@ -201,8 +200,7 @@ script_repo_get_filename_loaded (struct t_script_repo *script)
}
}
- if (weechat_data_dir)
- free (weechat_data_dir);
+ free (weechat_data_dir);
if (!filename[0])
{
@@ -625,34 +623,20 @@ script_repo_free (struct t_script_repo *script)
if (!script)
return;
- if (script->name)
- free (script->name);
- if (script->name_with_extension)
- free (script->name_with_extension);
- if (script->author)
- free (script->author);
- if (script->mail)
- free (script->mail);
- if (script->version)
- free (script->version);
- if (script->license)
- free (script->license);
- if (script->description)
- free (script->description);
- if (script->tags)
- free (script->tags);
- if (script->requirements)
- free (script->requirements);
- if (script->min_weechat)
- free (script->min_weechat);
- if (script->max_weechat)
- free (script->max_weechat);
- if (script->sha512sum)
- free (script->sha512sum);
- if (script->url)
- free (script->url);
- if (script->version_loaded)
- free (script->version_loaded);
+ free (script->name);
+ free (script->name_with_extension);
+ free (script->author);
+ free (script->mail);
+ free (script->version);
+ free (script->license);
+ free (script->description);
+ free (script->tags);
+ free (script->requirements);
+ free (script->min_weechat);
+ free (script->max_weechat);
+ free (script->sha512sum);
+ free (script->url);
+ free (script->version_loaded);
free (script);
}
@@ -820,8 +804,7 @@ script_repo_update_status (struct t_script_repo *script)
free (filename);
}
- if (weechat_data_dir)
- free (weechat_data_dir);
+ free (weechat_data_dir);
/* check if script is held */
if (script_repo_script_is_held (script))
@@ -832,8 +815,7 @@ script_repo_update_status (struct t_script_repo *script)
if (version)
{
script->status |= SCRIPT_STATUS_RUNNING;
- if (script->version_loaded)
- free (script->version_loaded);
+ free (script->version_loaded);
script->version_loaded = strdup (version);
}
else
@@ -865,8 +847,7 @@ script_repo_update_status (struct t_script_repo *script)
}
}
- if (sha512sum)
- free (sha512sum);
+ free (sha512sum);
}
/*
@@ -892,8 +873,7 @@ script_repo_update_status_all ()
void
script_repo_set_filter (const char *filter)
{
- if (script_repo_filter)
- free (script_repo_filter);
+ free (script_repo_filter);
script_repo_filter = (filter) ? strdup (filter) : NULL;
script_buffer_set_localvar_filter ();
@@ -1151,8 +1131,7 @@ script_repo_file_read (int quiet)
version = weechat_info_get ("version", NULL);
version_number = weechat_util_version_number (version);
- if (version)
- free (version);
+ free (version);
filename = script_config_get_xml_filename ();
if (!filename)
@@ -1375,16 +1354,11 @@ script_repo_file_read (int quiet)
script->date_updated = mktime (&tm_script);
}
}
- if (name)
- free (name);
- if (value1)
- free (value1);
- if (value2)
- free (value2);
- if (value3)
- free (value3);
- if (value)
- free (value);
+ free (name);
+ free (value1);
+ free (value2);
+ free (value3);
+ free (value);
}
}
}
@@ -1401,8 +1375,7 @@ script_repo_file_read (int quiet)
_("%s: %d scripts for WeeChat %s"),
SCRIPT_PLUGIN_NAME, script_repo_count,
version);
- if (version)
- free (version);
+ free (version);
}
if (!scripts_repo)
@@ -1416,10 +1389,8 @@ script_repo_file_read (int quiet)
if (script)
script_repo_free (script);
- if (locale)
- free (locale);
- if (locale_language)
- free (locale_language);
+ free (locale);
+ free (locale_language);
if (descriptions)
weechat_hashtable_free (descriptions);