diff options
Diffstat (limited to 'src')
41 files changed, 388 insertions, 394 deletions
diff --git a/src/core/hook/wee-hook-command.c b/src/core/hook/wee-hook-command.c index 2cf2d8349..435b0d702 100644 --- a/src/core/hook/wee-hook-command.c +++ b/src/core/hook/wee-hook-command.c @@ -69,7 +69,7 @@ hook_command_search (struct t_weechat_plugin *plugin, const char *command) { if (!ptr_hook->deleted && (ptr_hook->plugin == plugin) - && (string_strcmp (HOOK_COMMAND(ptr_hook, command), command) == 0)) + && (strcmp (HOOK_COMMAND(ptr_hook, command), command) == 0)) return ptr_hook; } @@ -409,8 +409,7 @@ hook_command_exec (struct t_gui_buffer *buffer, int any_plugin, if (!ptr_hook->deleted) { - if (string_strcmp (ptr_command_name, - HOOK_COMMAND(ptr_hook, command)) == 0) + if (strcmp (ptr_command_name, HOOK_COMMAND(ptr_hook, command)) == 0) { if (ptr_hook->plugin == plugin) { diff --git a/src/core/hook/wee-hook-completion.c b/src/core/hook/wee-hook-completion.c index 06cc36ff6..16b1a566e 100644 --- a/src/core/hook/wee-hook-completion.c +++ b/src/core/hook/wee-hook-completion.c @@ -132,8 +132,7 @@ hook_completion_exec (struct t_weechat_plugin *plugin, if (!ptr_hook->deleted && !ptr_hook->running - && (string_strcmp (HOOK_COMPLETION(ptr_hook, completion_item), - item) == 0)) + && (strcmp (HOOK_COMPLETION(ptr_hook, completion_item), item) == 0)) { ptr_hook->running = 1; (void) (HOOK_COMPLETION(ptr_hook, callback)) diff --git a/src/core/hook/wee-hook-info-hashtable.c b/src/core/hook/wee-hook-info-hashtable.c index 1734c8704..66b493c79 100644 --- a/src/core/hook/wee-hook-info-hashtable.c +++ b/src/core/hook/wee-hook-info-hashtable.c @@ -123,8 +123,7 @@ hook_info_get_hashtable (struct t_weechat_plugin *plugin, const char *info_name, if (!ptr_hook->deleted && !ptr_hook->running - && (string_strcmp (HOOK_INFO_HASHTABLE(ptr_hook, info_name), - info_name) == 0)) + && (strcmp (HOOK_INFO_HASHTABLE(ptr_hook, info_name), info_name) == 0)) { ptr_hook->running = 1; value = (HOOK_INFO_HASHTABLE(ptr_hook, callback)) diff --git a/src/core/hook/wee-hook-info.c b/src/core/hook/wee-hook-info.c index 9d96a5252..b66c867eb 100644 --- a/src/core/hook/wee-hook-info.c +++ b/src/core/hook/wee-hook-info.c @@ -122,8 +122,7 @@ hook_info_get (struct t_weechat_plugin *plugin, const char *info_name, if (!ptr_hook->deleted && !ptr_hook->running - && (string_strcmp (HOOK_INFO(ptr_hook, info_name), - info_name) == 0)) + && (strcmp (HOOK_INFO(ptr_hook, info_name), info_name) == 0)) { ptr_hook->running = 1; value = (HOOK_INFO(ptr_hook, callback)) diff --git a/src/core/hook/wee-hook-infolist.c b/src/core/hook/wee-hook-infolist.c index a3a5f29cc..b75722c11 100644 --- a/src/core/hook/wee-hook-infolist.c +++ b/src/core/hook/wee-hook-infolist.c @@ -123,8 +123,7 @@ hook_infolist_get (struct t_weechat_plugin *plugin, const char *infolist_name, if (!ptr_hook->deleted && !ptr_hook->running - && (string_strcmp (HOOK_INFOLIST(ptr_hook, infolist_name), - infolist_name) == 0)) + && (strcmp (HOOK_INFOLIST(ptr_hook, infolist_name), infolist_name) == 0)) { ptr_hook->running = 1; value = (HOOK_INFOLIST(ptr_hook, callback)) diff --git a/src/core/wee-completion.c b/src/core/wee-completion.c index 1a544cdd9..0e307c203 100644 --- a/src/core/wee-completion.c +++ b/src/core/wee-completion.c @@ -1262,7 +1262,7 @@ completion_list_add_plugins_commands_cb (const void *pointer, void *data, arg_index = argc - 1; ptr_plugin = NULL; - if (string_strcmp (argv[arg_index], PLUGIN_CORE) != 0) + if (strcmp (argv[arg_index], PLUGIN_CORE) != 0) { /* * plugin name is different from "core", then search it in diff --git a/src/core/wee-config-file.c b/src/core/wee-config-file.c index 560309c27..14a682516 100644 --- a/src/core/wee-config-file.c +++ b/src/core/wee-config-file.c @@ -692,7 +692,7 @@ config_file_new_option (struct t_config_file *config_file, option_name = NULL; parent_name = NULL; - if (!name) + if (!name || !type) goto error; pos = strstr (name, " << "); @@ -715,7 +715,7 @@ config_file_new_option (struct t_config_file *config_file, var_type = -1; for (i = 0; i < CONFIG_NUM_OPTION_TYPES; i++) { - if (string_strcmp (type, config_option_type_string[i]) == 0) + if (strcmp (type, config_option_type_string[i]) == 0) { var_type = i; break; @@ -802,8 +802,8 @@ config_file_new_option (struct t_config_file *config_file, index_value = 0; for (i = 0; i < argc; i++) { - if (string_strcmp (new_option->string_values[i], - default_value) == 0) + if (strcmp (new_option->string_values[i], + default_value) == 0) { index_value = i; break; @@ -819,8 +819,8 @@ config_file_new_option (struct t_config_file *config_file, index_value = 0; for (i = 0; i < argc; i++) { - if (string_strcmp (new_option->string_values[i], - value) == 0) + if (strcmp (new_option->string_values[i], + value) == 0) { index_value = i; break; @@ -1162,13 +1162,13 @@ config_file_string_boolean_is_valid (const char *text) for (i = 0; config_boolean_true[i]; i++) { - if (string_strcmp (text, config_boolean_true[i]) == 0) + if (strcmp (text, config_boolean_true[i]) == 0) return 1; } for (i = 0; config_boolean_false[i]; i++) { - if (string_strcmp (text, config_boolean_false[i]) == 0) + if (strcmp (text, config_boolean_false[i]) == 0) return 1; } @@ -1194,7 +1194,7 @@ config_file_string_to_boolean (const char *text) for (i = 0; config_boolean_true[i]; i++) { - if (string_strcmp (text, config_boolean_true[i]) == 0) + if (strcmp (text, config_boolean_true[i]) == 0) return CONFIG_BOOLEAN_TRUE; } @@ -1380,7 +1380,7 @@ config_file_option_set (struct t_config_option *option, const char *value, option->value = malloc (sizeof (int)); if (option->value) { - if (string_strcmp (value, "toggle") == 0) + if (strcmp (value, "toggle") == 0) { CONFIG_BOOLEAN(option) = CONFIG_BOOLEAN_TRUE; rc = WEECHAT_CONFIG_OPTION_SET_OK_CHANGED; @@ -1403,7 +1403,7 @@ config_file_option_set (struct t_config_option *option, const char *value, } else { - if (string_strcmp (value, "toggle") == 0) + if (strcmp (value, "toggle") == 0) { CONFIG_BOOLEAN(option) = (CONFIG_BOOLEAN(option) == CONFIG_BOOLEAN_TRUE) ? @@ -1463,8 +1463,7 @@ config_file_option_set (struct t_config_option *option, const char *value, { for (i = 0; option->string_values[i]; i++) { - if (string_strcmp (option->string_values[i], - value) == 0) + if (strcmp (option->string_values[i], value) == 0) { value_int = i; break; @@ -2106,17 +2105,17 @@ config_file_option_get_string (struct t_config_option *option, if (!option || !property) return NULL; - if (string_strcmp (property, "config_name") == 0) + if (strcmp (property, "config_name") == 0) return option->config_file->name; - else if (string_strcmp (property, "section_name") == 0) + else if (strcmp (property, "section_name") == 0) return option->section->name; - else if (string_strcmp (property, "name") == 0) + else if (strcmp (property, "name") == 0) return option->name; - else if (string_strcmp (property, "parent_name") == 0) + else if (strcmp (property, "parent_name") == 0) return option->parent_name; - else if (string_strcmp (property, "type") == 0) + else if (strcmp (property, "type") == 0) return config_option_type_string[option->type]; - else if (string_strcmp (property, "description") == 0) + else if (strcmp (property, "description") == 0) return option->description; return NULL; @@ -2133,31 +2132,31 @@ config_file_option_get_pointer (struct t_config_option *option, if (!option || !property) return NULL; - if (string_strcmp (property, "config_file") == 0) + if (strcmp (property, "config_file") == 0) return option->config_file; - else if (string_strcmp (property, "section") == 0) + else if (strcmp (property, "section") == 0) return option->section; - else if (string_strcmp (property, "name") == 0) + else if (strcmp (property, "name") == 0) return option->name; - else if (string_strcmp (property, "parent_name") == 0) + else if (strcmp (property, "parent_name") == 0) return option->parent_name; - else if (string_strcmp (property, "type") == 0) + else if (strcmp (property, "type") == 0) return &option->type; - else if (string_strcmp (property, "description") == 0) + else if (strcmp (property, "description") == 0) return option->description; - else if (string_strcmp (property, "string_values") == 0) + else if (strcmp (property, "string_values") == 0) return option->string_values; - else if (string_strcmp (property, "min") == 0) + else if (strcmp (property, "min") == 0) return &option->min; - else if (string_strcmp (property, "max") == 0) + else if (strcmp (property, "max") == 0) return &option->max; - else if (string_strcmp (property, "default_value") == 0) + else if (strcmp (property, "default_value") == 0) return option->default_value; - else if (string_strcmp (property, "value") == 0) + else if (strcmp (property, "value") == 0) return option->value; - else if (string_strcmp (property, "prev_option") == 0) + else if (strcmp (property, "prev_option") == 0) return option->prev_option; - else if (string_strcmp (property, "next_option") == 0) + else if (strcmp (property, "next_option") == 0) return option->next_option; return NULL; @@ -2944,7 +2943,7 @@ config_file_read_internal (struct t_config_file *config_file, int reload) } if (pos[0] - && string_strcmp (pos, WEECHAT_CONFIG_OPTION_NULL) != 0) + && strcmp (pos, WEECHAT_CONFIG_OPTION_NULL) != 0) { undefined_value = 0; /* remove simple or double quotes and spaces at the end */ diff --git a/src/core/wee-config.c b/src/core/wee-config.c index b11755eed..72d9ec72c 100644 --- a/src/core/wee-config.c +++ b/src/core/wee-config.c @@ -2114,7 +2114,7 @@ config_weechat_layout_read_cb (const void *pointer, void *data, gui_layout_add (ptr_layout); } - if (string_strcmp (ptr_option_name, "buffer") == 0) + if (strcmp (ptr_option_name, "buffer") == 0) { argv = string_split (value, ";", NULL, WEECHAT_STRING_SPLIT_STRIP_LEFT @@ -2133,7 +2133,7 @@ config_weechat_layout_read_cb (const void *pointer, void *data, string_free_split (argv); } } - else if (string_strcmp (ptr_option_name, "window") == 0) + else if (strcmp (ptr_option_name, "window") == 0) { argv = string_split (value, ";", NULL, WEECHAT_STRING_SPLIT_STRIP_LEFT @@ -2171,7 +2171,7 @@ config_weechat_layout_read_cb (const void *pointer, void *data, string_free_split (argv); } } - else if (string_strcmp (ptr_option_name, "current") == 0) + else if (strcmp (ptr_option_name, "current") == 0) { if (config_file_string_to_boolean (value)) gui_layout_current = ptr_layout; diff --git a/src/core/wee-debug.c b/src/core/wee-debug.c index a6cb5a3be..49e7cca61 100644 --- a/src/core/wee-debug.c +++ b/src/core/wee-debug.c @@ -137,7 +137,7 @@ debug_dump_cb (const void *pointer, void *data, (void) signal; (void) type_data; - if (!signal_data || (string_strcmp ((char *)signal_data, PLUGIN_CORE) == 0)) + if (!signal_data || (strcmp ((char *)signal_data, PLUGIN_CORE) == 0)) debug_dump (0); return WEECHAT_RC_OK; diff --git a/src/core/wee-hashtable.c b/src/core/wee-hashtable.c index d6dd45d0d..8be417dba 100644 --- a/src/core/wee-hashtable.c +++ b/src/core/wee-hashtable.c @@ -747,13 +747,13 @@ hashtable_get_list_keys (struct t_hashtable *hashtable) int hashtable_get_integer (struct t_hashtable *hashtable, const char *property) { - if (hashtable && property) - { - if (string_strcmp (property, "size") == 0) - return hashtable->size; - else if (string_strcmp (property, "items_count") == 0) - return hashtable->items_count; - } + if (!hashtable || !property) + return 0; + + if (strcmp (property, "size") == 0) + return hashtable->size; + else if (strcmp (property, "items_count") == 0) + return hashtable->items_count; return 0; } @@ -1003,23 +1003,23 @@ hashtable_get_keys_values (struct t_hashtable *hashtable, const char * hashtable_get_string (struct t_hashtable *hashtable, const char *property) { - if (hashtable && property) - { - if (string_strcmp (property, "type_keys") == 0) - return hashtable_type_string[hashtable->type_keys]; - else if (string_strcmp (property, "type_values") == 0) - return hashtable_type_string[hashtable->type_values]; - else if (string_strcmp (property, "keys") == 0) - return hashtable_get_keys_values (hashtable, 1, 0, 0); - else if (string_strcmp (property, "keys_sorted") == 0) - return hashtable_get_keys_values (hashtable, 1, 1, 0); - else if (string_strcmp (property, "values") == 0) - return hashtable_get_keys_values (hashtable, 0, 0, 1); - else if (string_strcmp (property, "keys_values") == 0) - return hashtable_get_keys_values (hashtable, 1, 0, 1); - else if (string_strcmp (property, "keys_values_sorted") == 0) - return hashtable_get_keys_values (hashtable, 1, 1, 1); - } + if (!hashtable || !property) + return NULL; + + if (strcmp (property, "type_keys") == 0) + return hashtable_type_string[hashtable->type_keys]; + else if (strcmp (property, "type_values") == 0) + return hashtable_type_string[hashtable->type_values]; + else if (strcmp (property, "keys") == 0) + return hashtable_get_keys_values (hashtable, 1, 0, 0); + else if (strcmp (property, "keys_sorted") == 0) + return hashtable_get_keys_values (hashtable, 1, 1, 0); + else if (strcmp (property, "values") == 0) + return hashtable_get_keys_values (hashtable, 0, 0, 1); + else if (strcmp (property, "keys_values") == 0) + return hashtable_get_keys_values (hashtable, 1, 0, 1); + else if (strcmp (property, "keys_values_sorted") == 0) + return hashtable_get_keys_values (hashtable, 1, 1, 1); return NULL; } @@ -1032,13 +1032,13 @@ void hashtable_set_pointer (struct t_hashtable *hashtable, const char *property, void *pointer) { - if (hashtable && property) - { - if (string_strcmp (property, "callback_free_key") == 0) - hashtable->callback_free_key = pointer; - else if (string_strcmp (property, "callback_free_value") == 0) - hashtable->callback_free_value = pointer; - } + if (!hashtable || !property) + return; + + if (strcmp (property, "callback_free_key") == 0) + hashtable->callback_free_key = pointer; + else if (strcmp (property, "callback_free_value") == 0) + hashtable->callback_free_value = pointer; } /* diff --git a/src/core/wee-hdata.c b/src/core/wee-hdata.c index 3c0a804d0..502f30c32 100644 --- a/src/core/wee-hdata.c +++ b/src/core/wee-hdata.c @@ -1207,21 +1207,21 @@ hdata_get_string (struct t_hdata *hdata, const char *property) if (!hdata || !property) return NULL; - if (string_strcmp (property, "var_keys") == 0) + if (strcmp (property, "var_keys") == 0) return hashtable_get_string (hdata->hash_var, "keys"); - else if (string_strcmp (property, "var_values") == 0) + else if (strcmp (property, "var_values") == 0) return hashtable_get_string (hdata->hash_var, "values"); - else if (string_strcmp (property, "var_keys_values") == 0) + else if (strcmp (property, "var_keys_values") == 0) return hashtable_get_string (hdata->hash_var, "keys_values"); - else if (string_strcmp (property, "var_prev") == 0) + else if (strcmp (property, "var_prev") == 0) return hdata->var_prev; - else if (string_strcmp (property, "var_next") == 0) + else if (strcmp (property, "var_next") == 0) return hdata->var_next; - else if (string_strcmp (property, "list_keys") == 0) + else if (strcmp (property, "list_keys") == 0) return hashtable_get_string (hdata->hash_list, "keys"); - else if (string_strcmp (property, "list_values") == 0) + else if (strcmp (property, "list_values") == 0) return hashtable_get_string (hdata->hash_list, "values"); - else if (string_strcmp (property, "list_keys_values") == 0) + else if (strcmp (property, "list_keys_values") == 0) return hashtable_get_string (hdata->hash_list, "keys_values"); return NULL; diff --git a/src/core/wee-hook.c b/src/core/wee-hook.c index db44ba307..4af120833 100644 --- a/src/core/wee-hook.c +++ b/src/core/wee-hook.c @@ -454,13 +454,16 @@ hook_set (struct t_hook *hook, const char *property, const char *value) if (!hook_valid (hook)) return; - if (string_strcmp (property, "subplugin") == 0) + if (!property) + return; + + if (strcmp (property, "subplugin") == 0) { if (hook->subplugin) free (hook->subplugin); hook->subplugin = strdup (value); } - else if (string_strcmp (property, "stdin") == 0) + else if (strcmp (property, "stdin") == 0) { if (!hook->deleted && (hook->type == HOOK_TYPE_PROCESS) @@ -472,7 +475,7 @@ hook_set (struct t_hook *hook, const char *property, const char *value) (void) num_written; } } - else if (string_strcmp (property, "stdin_close") == 0) + else if (strcmp (property, "stdin_close") == 0) { if (!hook->deleted && (hook->type == HOOK_TYPE_PROCESS) @@ -483,7 +486,7 @@ hook_set (struct t_hook *hook, const char *property, const char *value) HOOK_PROCESS(hook, child_write[HOOK_PROCESS_STDIN]) = -1; } } - else if (string_strcmp (property, "signal") == 0) + else if (strcmp (property, "signal") == 0) { if (!hook->deleted && (hook->type == HOOK_TYPE_PROCESS) diff --git a/src/core/wee-infolist.c b/src/core/wee-infolist.c index 9ae9d35a5..b8bdf8764 100644 --- a/src/core/wee-infolist.c +++ b/src/core/wee-infolist.c @@ -366,7 +366,7 @@ infolist_search_var (struct t_infolist *infolist, const char *name) for (ptr_var = infolist->ptr_item->vars; ptr_var; ptr_var = ptr_var->next_var) { - if (string_strcmp (ptr_var->name, name) == 0) + if (strcmp (ptr_var->name, name) == 0) return ptr_var; } @@ -447,7 +447,7 @@ infolist_integer (struct t_infolist *infolist, const char *var) for (ptr_var = infolist->ptr_item->vars; ptr_var; ptr_var = ptr_var->next_var) { - if (string_strcmp (ptr_var->name, var) == 0) + if (strcmp (ptr_var->name, var) == 0) { if (ptr_var->type == INFOLIST_INTEGER) return *((int *)ptr_var->value); @@ -475,7 +475,7 @@ infolist_string (struct t_infolist *infolist, const char *var) for (ptr_var = infolist->ptr_item->vars; ptr_var; ptr_var = ptr_var->next_var) { - if (string_strcmp (ptr_var->name, var) == 0) + if (strcmp (ptr_var->name, var) == 0) { if (ptr_var->type == INFOLIST_STRING) return (char *)ptr_var->value; @@ -503,7 +503,7 @@ infolist_pointer (struct t_infolist *infolist, const char *var) for (ptr_var = infolist->ptr_item->vars; ptr_var; ptr_var = ptr_var->next_var) { - if (string_strcmp (ptr_var->name, var) == 0) + if (strcmp (ptr_var->name, var) == 0) { if (ptr_var->type == INFOLIST_POINTER) return ptr_var->value; @@ -534,7 +534,7 @@ infolist_buffer (struct t_infolist *infolist, const char *var, for (ptr_var = infolist->ptr_item->vars; ptr_var; ptr_var = ptr_var->next_var) { - if (string_strcmp (ptr_var->name, var) == 0) + if (strcmp (ptr_var->name, var) == 0) { if (ptr_var->type == INFOLIST_BUFFER) { @@ -565,7 +565,7 @@ infolist_time (struct t_infolist *infolist, const char *var) for (ptr_var = infolist->ptr_item->vars; ptr_var; ptr_var = ptr_var->next_var) { - if (string_strcmp (ptr_var->name, var) == 0) + if (strcmp (ptr_var->name, var) == 0) { if (ptr_var->type == INFOLIST_TIME) return *((time_t *)ptr_var->value); diff --git a/src/core/wee-proxy.c b/src/core/wee-proxy.c index 0b910930b..c35fea5d4 100644 --- a/src/core/wee-proxy.c +++ b/src/core/wee-proxy.c @@ -203,37 +203,37 @@ proxy_set (struct t_proxy *proxy, const char *property, const char *value) if (!proxy || !property || !value) return 0; - if (string_strcmp (property, "name") == 0) + if (strcmp (property, "name") == 0) { proxy_set_name (proxy, value); return 1; } - else if (string_strcmp (property, "type") == 0) + else if (strcmp (property, "type") == 0) { config_file_option_set (proxy->options[PROXY_OPTION_TYPE], value, 1); return 1; } - else if (string_strcmp (property, "ipv6") == 0) + else if (strcmp (property, "ipv6") == 0) { config_file_option_set (proxy->options[PROXY_OPTION_IPV6], value, 1); return 1; } - else if (string_strcmp (property, "address") == 0) + else if (strcmp (property, "address") == 0) { config_file_option_set (proxy->options[PROXY_OPTION_ADDRESS], value, 1); return 1; } - else if (string_strcmp (property, "port") == 0) + else if (strcmp (property, "port") == 0) { config_file_option_set (proxy->options[PROXY_OPTION_PORT], value, 1); return 1; } - else if (string_strcmp (property, "username") == 0) + else if (strcmp (property, "username") == 0) { config_file_option_set (proxy->options[PROXY_OPTION_USERNAME], value, 1); return 1; } - else if (string_strcmp (property, "password") == 0) + else if (strcmp (property, "password") == 0) { config_file_option_set (proxy->options[PROXY_OPTION_PASSWORD], value, 1); return 1; diff --git a/src/gui/curses/gui-curses-color.c b/src/gui/curses/gui-curses-color.c index fc34ab914..d08f46bfc 100644 --- a/src/gui/curses/gui-curses-color.c +++ b/src/gui/curses/gui-curses-color.c @@ -128,7 +128,7 @@ gui_color_search (const char *color_name) for (i = 0; gui_weechat_colors[i].string; i++) { - if (string_strcmp (gui_weechat_colors[i].string, color_name) == 0) + if (strcmp (gui_weechat_colors[i].string, color_name) == 0) return i; } diff --git a/src/gui/gui-bar-item-custom.c b/src/gui/gui-bar-item-custom.c index 1628762e8..2864f3cb2 100644 --- a/src/gui/gui-bar-item-custom.c +++ b/src/gui/gui-bar-item-custom.c @@ -96,8 +96,7 @@ gui_bar_item_custom_search_option (const char *option_name) for (i = 0; i < GUI_BAR_ITEM_CUSTOM_NUM_OPTIONS; i++) { - if (string_strcmp (gui_bar_item_custom_option_string[i], - option_name) == 0) + if (strcmp (gui_bar_item_custom_option_string[i], option_name) == 0) return i; } @@ -154,7 +153,7 @@ gui_bar_item_custom_search_with_option_name (const char *option_name) for (ptr_item = gui_custom_bar_items; ptr_item; ptr_item = ptr_item->next_item) { - if (string_strcmp (ptr_item->name, item_name) == 0) + if (strcmp (ptr_item->name, item_name) == 0) break; } free (item_name); diff --git a/src/gui/gui-bar.c b/src/gui/gui-bar.c index 6047ed07e..8b2e9ffd7 100644 --- a/src/gui/gui-bar.c +++ b/src/gui/gui-bar.c @@ -114,7 +114,7 @@ gui_bar_search_option (const char *option_name) for (i = 0; i < GUI_BAR_NUM_OPTIONS; i++) { - if (string_strcmp (gui_bar_option_string[i], option_name) == 0) + if (strcmp (gui_bar_option_string[i], option_name) == 0) return i; } @@ -138,7 +138,7 @@ gui_bar_search_type (const char *type) for (i = 0; i < GUI_BAR_NUM_TYPES; i++) { - if (string_strcmp (gui_bar_type_string[i], type) == 0) + if (strcmp (gui_bar_type_string[i], type) == 0) return i; } @@ -162,7 +162,7 @@ gui_bar_search_position (const char *position) for (i = 0; i < GUI_BAR_NUM_POSITIONS; i++) { - if (string_strcmp (gui_bar_position_string[i], position) == 0) + if (strcmp (gui_bar_position_string[i], position) == 0) return i; } @@ -450,7 +450,7 @@ gui_bar_search (const char *name) for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar) { - if (string_strcmp (ptr_bar->name, name) == 0) + if (strcmp (ptr_bar->name, name) == 0) return ptr_bar; } @@ -483,7 +483,7 @@ gui_bar_search_with_option_name (const char *option_name) { for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar) { - if (string_strcmp (ptr_bar->name, bar_name) == 0) + if (strcmp (ptr_bar->name, bar_name) == 0) break; } free (bar_name); @@ -1219,76 +1219,76 @@ gui_bar_set (struct t_gui_bar *bar, const char *property, const char *value) if (!bar || !property || !value) return 0; - if (string_strcmp (property, "name") == 0) + if (strcmp (property, "name") == 0) { gui_bar_set_name (bar, value); return 1; } - else if (string_strcmp (property, "hidden") == 0) + else if (strcmp (property, "hidden") == 0) { config_file_option_set (bar->options[GUI_BAR_OPTION_HIDDEN], value, 1); return 1; } - else if (string_strcmp (property, "priority") == 0) + else if (strcmp (property, "priority") == 0) { config_file_option_set (bar->options[GUI_BAR_OPTION_PRIORITY], value, 1); return 1; } - else if (string_strcmp (property, "conditions") == 0) + else if (strcmp (property, "conditions") == 0) { config_file_option_set (bar->options[GUI_BAR_OPTION_CONDITIONS], value, 1); return 1; } - else if (string_strcmp (property, "position") == 0) + else if (strcmp (property, "position") == 0) { config_file_option_set (bar->options[GUI_BAR_OPTION_POSITION], value, 1); return 1; } - else if (string_strcmp (property, "filling_top_bottom") == 0) + else if (strcmp (property, "filling_top_bottom") == 0) { config_file_option_set (bar->options[GUI_BAR_OPTION_FILLING_TOP_BOTTOM], value, 1); return 1; } - else if (string_strcmp (property, "filling_left_right") == 0) + else if (strcmp (property, "filling_left_right") == 0) { config_file_option_set (bar->options[GUI_BAR_OPTION_FILLING_LEFT_RIGHT], value, 1); return 1; } - else if (string_strcmp (property, "size") == 0) + else if (strcmp (property, "size") == 0) { config_file_option_set (bar->options[GUI_BAR_OPTION_SIZE], value, 1); return 1; } - else if (string_strcmp (property, "size_max") == 0) + else if (strcmp (property, "size_max") == 0) { config_file_option_set (bar->options[GUI_BAR_OPTION_SIZE_MAX], value, 1); return 1; } - else if (string_strcmp (property, "color_fg") == 0) + else if (strcmp (property, "color_fg") == 0) { config_file_option_set (bar->options[GUI_BAR_OPTION_COLOR_FG], value, 1); gui_bar_refresh (bar); return 1; } - else if (string_strcmp (property, "color_delim") == 0) + else if (strcmp (property, "color_delim") == 0) { config_file_option_set (bar->options[GUI_BAR_OPTION_COLOR_DELIM], value, 1); gui_bar_refresh (bar); return 1; } - else if (string_strcmp (property, "color_bg") == 0) + else if (strcmp (property, "color_bg") == 0) { config_file_option_set (bar->options[GUI_BAR_OPTION_COLOR_BG], value, 1); gui_bar_refresh (bar); return 1; } - else if (string_strcmp (property, "color_bg_inactive") == 0) + else if (strcmp (property, "color_bg_inactive") == 0) { config_file_option_set (bar->options[GUI_BAR_OPTION_COLOR_BG_INACTIVE], value, 1); gui_bar_refresh (bar); return 1; } - else if (string_strcmp (property, "separator") == 0) + else if (strcmp (property, "separator") == 0) { config_file_option_set (bar->options[GUI_BAR_OPTION_SEPARATOR], (strcmp (value, "1") == 0) ? "on" : "off", @@ -1296,7 +1296,7 @@ gui_bar_set (struct t_gui_bar *bar, const char *property, const char *value) gui_bar_refresh (bar); return 1; } - else if (string_strcmp (property, "items") == 0) + else if (strcmp (property, "items") == 0) { config_file_option_set (bar->options[GUI_BAR_OPTION_ITEMS], value, 1); gui_bar_draw (bar); @@ -1319,9 +1319,12 @@ gui_bar_default_items (const char *bar_name) int i; static char empty_items[1] = { '\0' }; + if (!bar_name) + return NULL; + for (i = 0; gui_bar_items_default_for_bars[i][0]; i++) { - if (string_strcmp (gui_bar_items_default_for_bars[i][0], bar_name) == 0) + if (strcmp (gui_bar_items_default_for_bars[i][0], bar_name) == 0) return gui_bar_items_default_for_bars[i][1]; } @@ -2054,10 +2057,13 @@ gui_bar_update (const char *name) { struct t_gui_bar *ptr_bar; + if (!name) + return; + for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar) { if (!CONFIG_BOOLEAN(ptr_bar->options[GUI_BAR_OPTION_HIDDEN]) - && (string_strcmp (ptr_bar->name, name) == 0)) + && (strcmp (ptr_bar->name, name) == 0)) { gui_bar_ask_refresh (ptr_bar); } diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index bfaca29c3..32449ecaf 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -1233,91 +1233,91 @@ gui_buffer_get_integer (struct t_gui_buffer *buffer, const char *property) if (!buffer || !property) return 0; - if (string_strcmp (property, "number") == 0) + if (strcmp (property, "number") == 0) return buffer->number; - else if (string_strcmp (property, "layout_number") == 0) + else if (strcmp (property, "layout_number") == 0) return buffer->layout_number; - else if (string_strcmp (property, "layout_number_merge_order") == 0) + else if (strcmp (property, "layout_number_merge_order") == 0) return buffer->layout_number_merge_order; - else if (string_strcmp (property, "short_name_is_set") == 0) + else if (strcmp (property, "short_name_is_set") == 0) return (buffer->short_name) ? 1 : 0; - else if (string_strcmp (property, "type") == 0) + else if (strcmp (property, "type") == 0) return buffer->type; - else if (string_strcmp (property, "notify") == 0) + else if (strcmp (property, "notify") == 0) return buffer->notify; - else if (string_strcmp (property, "num_displayed") == 0) + else if (strcmp (property, "num_displayed") == 0) return buffer->num_displayed; - else if (string_strcmp (property, "active") == 0) + else if (strcmp (property, "active") == 0) return buffer->active; - else if (string_strcmp (property, "hidden") == 0) + else if (strcmp (property, "hidden") == 0) return buffer->hidden; - else if (string_strcmp (property, "zoomed") == 0) + else if (strcmp (property, "zoomed") == 0) return buffer->zoomed; - else if (string_strcmp (property, "print_hooks_enabled") == 0) + else if (strcmp (property, "print_hooks_enabled") == 0) return buffer->print_hooks_enabled; - else if (string_strcmp (property, "day_change") == 0) + else if (strcmp (property, "day_change") == 0) return buffer->day_change; - else if (string_strcmp (property, "clear") == 0) + else if (strcmp (property, "clear") == 0) return buffer->clear; - else if (string_strcmp (property, "filter") == 0) + else if (strcmp (property, "filter") == 0) return buffer->filter; - else if (string_strcmp (property, "closing") == 0) + else if (strcmp (property, "closing") == 0) return buffer->closing; - else if (string_strcmp (property, "lines_hidden") == 0) + else if (strcmp (property, "lines_hidden") == 0) return buffer->lines->lines_hidden; - else if (string_strcmp (property, "prefix_max_length") == 0) + else if (strcmp (property, "prefix_max_length") == 0) return buffer->lines->prefix_max_length; - else if (string_strcmp (property, "next_line_id") == 0) + else if (strcmp (property, "next_line_id") == 0) return buffer->next_line_id; - else if (string_strcmp (property, "time_for_each_line") == 0) + else if (strcmp (property, "time_for_each_line") == 0) return buffer->time_for_each_line; - else if (string_strcmp (property, "nicklist") == 0) + else if (strcmp (property, "nicklist") == 0) return buffer->nicklist; - else if (string_strcmp (property, "nicklist_case_sensitive") == 0) + else if (strcmp (property, "nicklist_case_sensitive") == 0) return buffer->nicklist_case_sensitive; - else if (string_strcmp (property, "nicklist_max_length") == 0) + else if (strcmp (property, "nicklist_max_length") == 0) return buffer->nicklist_max_length; - else if (string_strcmp (property, "nicklist_display_groups") == 0) + else if (strcmp (property, "nicklist_display_groups") == 0) return buffer->nicklist_display_groups; - else if (string_strcmp (property, "nicklist_count") == 0) + else if (strcmp (property, "nicklist_count") == 0) return buffer->nicklist_count; - else if (string_strcmp (property, "nicklist_visible_count") == 0) + else if (strcmp (property, "nicklist_visible_count") == 0) return buffer->nicklist_visible_count; - else if (string_strcmp (property, "nicklist_groups_count") == 0) + else if (strcmp (property, "nicklist_groups_count") == 0) return buffer->nicklist_groups_count; - else if (string_strcmp (property, "nicklist_groups_visible_count") == 0) + else if (strcmp (property, "nicklist_groups_visible_count") == 0) return buffer->nicklist_groups_visible_count; - else if (string_strcmp (property, "nicklist_nicks_count") == 0) + else if (strcmp (property, "nicklist_nicks_count") == 0) return buffer->nicklist_nicks_count; - else if (string_strcmp (property, "nicklist_nicks_visible_count") == 0) + else if (strcmp (property, "nicklist_nicks_visible_count") == 0) return buffer->nicklist_nicks_visible_count; - else if (string_strcmp (property, "input") == 0) + else if (strcmp (property, "input") == 0) return buffer->input; - else if (string_strcmp (property, "input_get_unknown_commands") == 0) + else if (strcmp (property, "input_get_unknown_commands") == 0) return buffer->input_get_unknown_commands; - else if (string_strcmp (property, "input_get_empty") == 0) + else if (strcmp (property, "input_get_empty") == 0) return buffer->input_get_empty; - else if (string_strcmp (property, "input_multiline") == 0) + else if (strcmp (property, "input_multiline") == 0) return buffer->input_multiline; - else if (string_strcmp (property, "input_size") == 0) + else if (strcmp (property, "input_size") == 0) return buffer->input_buffer_size; - else if (string_strcmp (property, "input_length") == 0) + else if (strcmp (property, "input_length") == 0) return buffer->input_buffer_length; - else if (string_strcmp (property, "input_pos") == 0) + else if (strcmp (property, "input_pos") == 0) return buffer->input_buffer_pos; - else if (string_strcmp (property, "input_1st_display") == 0) + else if (strcmp (property, "input_1st_display") == 0) return buffer->input_buffer_1st_display; - else if (string_strcmp (property, "num_history") == 0) + else if (strcmp (property, "num_history") == 0) return buffer->num_history; - else if (string_strcmp (property, "text_search") == 0) + else if (strcmp (property, "text_search") == 0) return buffer->text_search; - else if (string_strcmp (property, "text_search_exact") == 0) + else if (strcmp (property, "text_search_exact") == 0) return buffer->text_search_exact; - else if (string_strcmp (property, "text_search_regex") == 0) + else if (strcmp (property, "text_search_regex") == 0) return buffer->text_search_regex; - else if (string_strcmp (property, "text_search_where") == 0) + else if (strcmp (property, "text_search_where") == 0) return buffer->text_search_where; - else if (string_strcmp (property, "text_search_found") == 0) + else if (strcmp (property, "text_search_found") == 0) return buffer->text_search_found; return 0; @@ -1335,33 +1335,33 @@ gui_buffer_get_string (struct t_gui_buffer *buffer, const char *property) if (!buffer || !property) return NULL; - if (string_strcmp (property, "plugin") == 0) + if (strcmp (property, "plugin") == 0) return gui_buffer_get_plugin_name (buffer); - else if (string_strcmp (property, "name") == 0) + else if (strcmp (property, "name") == 0) return buffer->name; - else if (string_strcmp (property, "full_name") == 0) + else if (strcmp (property, "full_name") == 0) return buffer->full_name; - else if (string_strcmp (property, "old_full_name") == 0) + else if (strcmp (property, "old_full_name") == 0) return buffer->old_full_name; - else if (string_strcmp (property, "short_name") == 0) + else if (strcmp (property, "short_name") == 0) return gui_buffer_get_short_name (buffer); - else if (string_strcmp (property, "title") == 0) + else if (strcmp (property, "title") == 0) return buffer->title; - else if (string_strcmp (property, "input") == 0) + else if (strcmp (property, "input") == 0) return buffer->input_buffer; - else if (string_strcmp (property, "text_search_input") == 0) + else if (strcmp (property, "text_search_input") == 0) return buffer->text_search_input; - else if (string_strcmp (property, "highlight_words") == 0) + else if (strcmp (property, "highlight_words") == 0) return buffer->highlight_words; - else if (string_strcmp (property, "highlight_disable_regex") == 0) + else if (strcmp (property, "highlight_disable_regex") == 0) return buffer->highlight_disable_regex; - else if (string_strcmp (property, "highlight_regex") == 0) + else if (strcmp (property, "highlight_regex") == 0) return buffer->highlight_regex; - else if (string_strcmp (property, "highlight_tags_restrict") == 0) + else if (strcmp (property, "highlight_tags_restrict") == 0) return buffer->highlight_tags_restrict; - else if (string_strcmp (property, "highlight_tags") == 0) + else if (strcmp (property, "highlight_tags") == 0) return buffer->highlight_tags; - else if (string_strcmp (property, "hotlist_max_level_nicks") == 0) + else if (strcmp (property, "hotlist_max_level_nicks") == 0) return hashtable_get_string (buffer->hotlist_max_level_nicks, "keys_values"); else if (string_strncmp (property, "localvar_", 9) == 0) { @@ -1384,13 +1384,13 @@ gui_buffer_get_pointer (struct t_gui_buffer *buffer, const char *property) if (!buffer || !property) return NULL; - if (string_strcmp (property, "plugin") == 0) + if (strcmp (property, "plugin") == 0) return buffer->plugin; - else if (string_strcmp (property, "text_search_regex_compiled") == 0) + else if (strcmp (property, "text_search_regex_compiled") == 0) return buffer->text_search_regex_compiled; - else if (string_strcmp (property, "highlight_disable_regex_compiled") == 0) + else if (strcmp (property, "highlight_disable_regex_compiled") == 0) return buffer->highlight_disable_regex_compiled; - else if (string_strcmp (property, "highlight_regex_compiled") == 0) + else if (strcmp (property, "highlight_regex_compiled") == 0) return buffer->highlight_regex_compiled; return NULL; @@ -2157,7 +2157,7 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property, return; /* properties with optional buffer */ - if (string_strcmp (property, "hotlist") == 0) + if (strcmp (property, "hotlist") == 0) { if (strcmp (value, "-") == 0) gui_add_hotlist = 0; @@ -2184,7 +2184,7 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property, } } } - else if (string_strcmp (property, "completion_freeze") == 0) + else if (strcmp (property, "completion_freeze") == 0) { gui_completion_freeze = (strcmp (value, "1") == 0) ? 1 : 0; } @@ -2193,23 +2193,24 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property, return; /* properties that need a buffer */ - if (string_strcmp (property, "unread") == 0) + if (strcmp (property, "unread") == 0) { remove_marker = (strcmp (value, "0") == 0); gui_buffer_set_unread (buffer, remove_marker); } - else if (string_strcmp (property, "display") == 0) + else if (strcmp (property, "display") == 0) { /* * if it is auto-switch to a buffer, then we don't set read marker, * otherwise we reset it (if current buffer is not displayed) after * switch */ - gui_window_switch_to_buffer (gui_current_window, buffer, - (string_strcmp (value, "auto") == 0) ? - 0 : 1); + gui_window_switch_to_buffer ( + gui_current_window, + buffer, + (value && (strcmp (value, "auto") == 0)) ? 0 : 1); } - else if (string_strcmp (property, "hidden") == 0) + else if (strcmp (property, "hidden") == 0) { error = NULL; number = strtol (value, &error, 10); @@ -2221,14 +2222,14 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property, gui_buffer_unhide (buffer); } } - else if (string_strcmp (property, "print_hooks_enabled") == 0) + else if (strcmp (property, "print_hooks_enabled") == 0) { error = NULL; number = strtol (value, &error, 10); if (error && !error[0]) buffer->print_hooks_enabled = (number) ? 1 : 0; } - else if (string_strcmp (property, "day_change") == 0) + else if (strcmp (property, "day_change") == 0) { error = NULL; number = strtol (value, &error, 10); @@ -2238,14 +2239,14 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property, gui_buffer_ask_chat_refresh (buffer, 2); } } - else if (string_strcmp (property, "clear") == 0) + else if (strcmp (property, "clear") == 0) { error = NULL; number = strtol (value, &error, 10); if (error && !error[0]) buffer->clear = (number) ? 1 : 0; } - else if (string_strcmp (property, "filter") == 0) + else if (strcmp (property, "filter") == 0) { error = NULL; number = strtol (value, &error, 10); @@ -2255,29 +2256,29 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property, gui_filter_buffer (buffer, NULL); } } - else if (string_strcmp (property, "number") == 0) + else if (strcmp (property, "number") == 0) { error = NULL; number = strtol (value, &error, 10); if (error && !error[0] && (number >= 1)) gui_buffer_move_to_number (buffer, number); } - else if (string_strcmp (property, "name") == 0) + else if (strcmp (property, "name") == 0) { gui_buffer_set_name (buffer, value); } - else if (string_strcmp (property, "short_name") == 0) + else if (strcmp (property, "short_name") == 0) { gui_buffer_set_short_name (buffer, value); } - else if (string_strcmp (property, "type") == 0) + else if (strcmp (property, "type") == 0) { - if (string_strcmp (value, "formatted") == 0) + if (value && (strcmp (value, "formatted") == 0)) gui_buffer_set_type (buffer, GUI_BUFFER_TYPE_FORMATTED); - else if (string_strcmp (value, "free") == 0) + else if (value && (strcmp (value, "free") == 0)) gui_buffer_set_type (buffer, GUI_BUFFER_TYPE_FREE); } - else if (string_strcmp (property, "notify") == 0) + else if (strcmp (property, "notify") == 0) { ptr_notify = NULL; error = NULL; @@ -2303,83 +2304,83 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property, gui_chat_mute = gui_chat_mute_old; } } - else if (string_strcmp (property, "title") == 0) + else if (strcmp (property, "title") == 0) { gui_buffer_set_title (buffer, value); } - else if (string_strcmp (property, "time_for_each_line") == 0) + else if (strcmp (property, "time_for_each_line") == 0) { error = NULL; number = strtol (value, &error, 10); if (error && !error[0]) gui_buffer_set_time_for_each_line (buffer, number); } - else if (string_strcmp (property, "nicklist") == 0) + else if (strcmp (property, "nicklist") == 0) { error = NULL; number = strtol (value, &error, 10); if (error && !error[0]) gui_buffer_set_nicklist (buffer, number); } - else if (string_strcmp (property, "nicklist_case_sensitive") == 0) + else if (strcmp (property, "nicklist_case_sensitive") == 0) { error = NULL; number = strtol (value, &error, 10); if (error && !error[0]) gui_buffer_set_nicklist_case_sensitive (buffer, number); } - else if (string_strcmp (property, "nicklist_display_groups") == 0) + else if (strcmp (property, "nicklist_display_groups") == 0) { error = NULL; number = strtol (value, &error, 10); if (error && !error[0]) gui_buffer_set_nicklist_display_groups (buffer, number); } - else if (string_strcmp (property, "highlight_words") == 0) + else if (strcmp (property, "highlight_words") == 0) { gui_buffer_set_highlight_words (buffer, value); } - else if (string_strcmp (property, "highlight_words_add") == 0) + else if (strcmp (property, "highlight_words_add") == 0) { gui_buffer_add_highlight_words (buffer, value); } - else if (string_strcmp (property, "highlight_words_del") == 0) + else if (strcmp (property, "highlight_words_del") == 0) { gui_buffer_remove_highlight_words (buffer, value); } - else if (string_strcmp (property, "highlight_disable_regex") == 0) + else if (strcmp (property, "highlight_disable_regex") == 0) { gui_buffer_set_highlight_disable_regex (buffer, value); } - else if (string_strcmp (property, "highlight_regex") == 0) + else if (strcmp (property, "highlight_regex") == 0) { gui_buffer_set_highlight_regex (buffer, value); } - else if (string_strcmp (property, "highlight_tags_restrict") == 0) + else if (strcmp (property, "highlight_tags_restrict") == 0) { gui_buffer_set_highlight_tags_restrict (buffer, value); } - else if (string_strcmp (property, "highlight_tags") == 0) + else if (strcmp (property, "highlight_tags") == 0) { gui_buffer_set_highlight_tags (buffer, value); } - else if (string_strcmp (property, "hotlist_max_level_nicks") == 0) + else if (strcmp (property, "hotlist_max_level_nicks") == 0) { gui_buffer_set_hotlist_max_level_nicks (buffer, value); } - else if (string_strcmp (property, "hotlist_max_level_nicks_add") == 0) + else if (strcmp (property, "hotlist_max_level_nicks_add") == 0) { gui_buffer_add_hotlist_max_level_nicks (buffer, value); } - else if (string_strcmp (property, "hotlist_max_level_nicks_del") == 0) + else if (strcmp (property, "hotlist_max_level_nicks_del") == 0) { gui_buffer_remove_hotlist_max_level_nicks (buffer, value); } - else if (string_strncmp (property, "key_bind_", 9) == 0) + else if (strncmp (property, "key_bind_", 9) == 0) { gui_key_bind (buffer, 0, property + 9, value); } - else if (string_strncmp (property, "key_unbind_", 11) == 0) + else if (strncmp (property, "key_unbind_", 11) == 0) { if (strcmp (property + 11, "*") == 0) { @@ -2389,7 +2390,7 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property, else gui_key_unbind (buffer, 0, property + 11); } - else if (string_strcmp (property, "input") == 0) + else if (strcmp (property, "input") == 0) { gui_buffer_undo_snap (buffer); gui_input_replace_input (buffer, value); @@ -2397,40 +2398,40 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property, 1, /* save undo */ 1); /* stop completion */ } - else if (string_strcmp (property, "input_pos") == 0) + else if (strcmp (property, "input_pos") == 0) { error = NULL; number = strtol (value, &error, 10); if (error && !error[0]) gui_input_set_pos (buffer, number); } - else if (string_strcmp (property, "input_get_unknown_commands") == 0) + else if (strcmp (property, "input_get_unknown_commands") == 0) { error = NULL; number = strtol (value, &error, 10); if (error && !error[0]) gui_buffer_set_input_get_unknown_commands (buffer, number); } - else if (string_strcmp (property, "input_get_empty") == 0) + else if (strcmp (property, "input_get_empty") == 0) { error = NULL; number = strtol (value, &error, 10); if (error && !error[0]) gui_buffer_set_input_get_empty (buffer, number); } - else if (string_strcmp (property, "input_multiline") == 0) + else if (strcmp (property, "input_multiline") == 0) { error = NULL; number = strtol (value, &error, 10); if (error && !error[0]) gui_buffer_set_input_multiline (buffer, number); } - else if (string_strncmp (property, "localvar_set_", 13) == 0) + else if (strncmp (property, "localvar_set_", 13) == 0) { if (value) gui_buffer_local_var_add (buffer, property + 13, value); } - else if (string_strncmp (property, "localvar_del_", 13) == 0) + else if (strncmp (property, "localvar_del_", 13) == 0) { gui_buffer_local_var_remove (buffer, property + 13); } @@ -2447,39 +2448,39 @@ gui_buffer_set_pointer (struct t_gui_buffer *buffer, const char *property, if (!buffer || !property) return; - if (string_strcmp (property, "close_callback") == 0) + if (strcmp (property, "close_callback") == 0) { buffer->close_callback = pointer; } - else if (string_strcmp (property, "close_callback_pointer") == 0) + else if (strcmp (property, "close_callback_pointer") == 0) { buffer->close_callback_pointer = pointer; } - else if (string_strcmp (property, "close_callback_data") == 0) + else if (strcmp (property, "close_callback_data") == 0) { buffer->close_callback_data = pointer; } - else if (string_strcmp (property, "nickcmp_callback") == 0) + else if (strcmp (property, "nickcmp_callback") == 0) { buffer->nickcmp_callback = pointer; } - else if (string_strcmp (property, "nickcmp_callback_pointer") == 0) + else if (strcmp (property, "nickcmp_callback_pointer") == 0) { buffer->nickcmp_callback_pointer = pointer; } - else if (string_strcmp (property, "nickcmp_callback_data") == 0) + else if (strcmp (property, "nickcmp_callback_data") == 0) { buffer->nickcmp_callback_data = pointer; } - else if (string_strcmp (property, "input_callback") == 0) + else if (strcmp (property, "input_callback") == 0) { buffer->input_callback = pointer; } - else if (string_strcmp (property, "input_callback_pointer") == 0) + else if (strcmp (property, "input_callback_pointer") == 0) { buffer->input_callback_pointer = pointer; } - else if (string_strcmp (property, "input_callback_data") == 0) + else if (strcmp (property, "input_callback_data") == 0) { buffer->input_callback_data = pointer; } diff --git a/src/gui/gui-color.c b/src/gui/gui-color.c index d27c4403a..4c1e8296e 100644 --- a/src/gui/gui-color.c +++ b/src/gui/gui-color.c @@ -276,111 +276,111 @@ gui_color_get_custom (const char *color_name) ptr_color_name - color_name); } - if (string_strcmp (ptr_color_name, "reset") == 0) + if (strcmp (ptr_color_name, "reset") == 0) { snprintf (color[index_color], sizeof (color[index_color]), "%c", GUI_COLOR_RESET_CHAR); } - else if (string_strcmp (ptr_color_name, "resetcolor") == 0) + else if (strcmp (ptr_color_name, "resetcolor") == 0) { snprintf (color[index_color], sizeof (color[index_color]), "%c%c", GUI_COLOR_COLOR_CHAR, GUI_COLOR_RESET_CHAR); } - else if (string_strcmp (ptr_color_name, "emphasis") == 0) + else if (strcmp (ptr_color_name, "emphasis") == 0) { snprintf (color[index_color], sizeof (color[index_color]), "%c%c", GUI_COLOR_COLOR_CHAR, GUI_COLOR_EMPHASIS_CHAR); } - else if (string_strcmp (ptr_color_name, "blink") == 0) + else if (strcmp (ptr_color_name, "blink") == 0) { snprintf (color[index_color], sizeof (color[index_color]), "%c%c", GUI_COLOR_SET_ATTR_CHAR, GUI_COLOR_ATTR_BLINK_CHAR); } - else if (string_strcmp (ptr_color_name, "-blink") == 0) + else if (strcmp (ptr_color_name, "-blink") == 0) { snprintf (color[index_color], sizeof (color[index_color]), "%c%c", GUI_COLOR_REMOVE_ATTR_CHAR, GUI_COLOR_ATTR_BLINK_CHAR); } - else if (string_strcmp (ptr_color_name, "dim") == 0) + else if (strcmp (ptr_color_name, "dim") == 0) { snprintf (color[index_color], sizeof (color[index_color]), "%c%c", GUI_COLOR_SET_ATTR_CHAR, GUI_COLOR_ATTR_DIM_CHAR); } - else if (string_strcmp (ptr_color_name, "-dim") == 0) + else if (strcmp (ptr_color_name, "-dim") == 0) { snprintf (color[index_color], sizeof (color[index_color]), "%c%c", GUI_COLOR_REMOVE_ATTR_CHAR, GUI_COLOR_ATTR_DIM_CHAR); } - else if (string_strcmp (ptr_color_name, "bold") == 0) + else if (strcmp (ptr_color_name, "bold") == 0) { snprintf (color[index_color], sizeof (color[index_color]), "%c%c", GUI_COLOR_SET_ATTR_CHAR, GUI_COLOR_ATTR_BOLD_CHAR); } - else if (string_strcmp (ptr_color_name, "-bold") == 0) + else if (strcmp (ptr_color_name, "-bold") == 0) { snprintf (color[index_color], sizeof (color[index_color]), "%c%c", GUI_COLOR_REMOVE_ATTR_CHAR, GUI_COLOR_ATTR_BOLD_CHAR); } - else if (string_strcmp (ptr_color_name, "reverse") == 0) + else if (strcmp (ptr_color_name, "reverse") == 0) { snprintf (color[index_color], sizeof (color[index_color]), "%c%c", GUI_COLOR_SET_ATTR_CHAR, GUI_COLOR_ATTR_REVERSE_CHAR); } - else if (string_strcmp (ptr_color_name, "-reverse") == 0) + else if (strcmp (ptr_color_name, "-reverse") == 0) { snprintf (color[index_color], sizeof (color[index_color]), "%c%c", GUI_COLOR_REMOVE_ATTR_CHAR, GUI_COLOR_ATTR_REVERSE_CHAR); } - else if (string_strcmp (ptr_color_name, "italic") == 0) + else if (strcmp (ptr_color_name, "italic") == 0) { snprintf (color[index_color], sizeof (color[index_color]), "%c%c", GUI_COLOR_SET_ATTR_CHAR, GUI_COLOR_ATTR_ITALIC_CHAR); } - else if (string_strcmp (ptr_color_name, "-italic") == 0) + else if (strcmp (ptr_color_name, "-italic") == 0) { snprintf (color[index_color], sizeof (color[index_color]), "%c%c", GUI_COLOR_REMOVE_ATTR_CHAR, GUI_COLOR_ATTR_ITALIC_CHAR); } - else if (string_strcmp (ptr_color_name, "underline") == 0) + else if (strcmp (ptr_color_name, "underline") == 0) { snprintf (color[index_color], sizeof (color[index_color]), "%c%c", GUI_COLOR_SET_ATTR_CHAR, GUI_COLOR_ATTR_UNDERLINE_CHAR); } - else if (string_strcmp (ptr_color_name, "-underline") == 0) + else if (strcmp (ptr_color_name, "-underline") == 0) { snprintf (color[index_color], sizeof (color[index_color]), "%c%c", GUI_COLOR_REMOVE_ATTR_CHAR, GUI_COLOR_ATTR_UNDERLINE_CHAR); } - else if (string_strcmp (ptr_color_name, "bar_fg") == 0) + else if (strcmp (ptr_color_name, "bar_fg") == 0) { snprintf (color[index_color], sizeof (color[index_color]), "%c%c%c", @@ -388,7 +388,7 @@ gui_color_get_custom (const char *color_name) GUI_COLOR_BAR_CHAR, GUI_COLOR_BAR_FG_CHAR); } - else if (string_strcmp (ptr_color_name, "bar_delim") == 0) + else if (strcmp (ptr_color_name, "bar_delim") == 0) { snprintf (color[index_color], sizeof (color[index_color]), "%c%c%c", @@ -396,7 +396,7 @@ gui_color_get_custom (const char *color_name) GUI_COLOR_BAR_CHAR, GUI_COLOR_BAR_DELIM_CHAR); } - else if (string_strcmp (ptr_color_name, "bar_bg") == 0) + else if (strcmp (ptr_color_name, "bar_bg") == 0) { snprintf (color[index_color], sizeof (color[index_color]), "%c%c%c", diff --git a/src/gui/gui-completion.c b/src/gui/gui-completion.c index ada4ce2bc..eccd8366f 100644 --- a/src/gui/gui-completion.c +++ b/src/gui/gui-completion.c @@ -335,7 +335,7 @@ gui_completion_search_command (struct t_weechat_plugin *plugin, && HOOK_COMMAND(ptr_hook, command) && HOOK_COMMAND(ptr_hook, command)[0]) { - if (string_strcmp (HOOK_COMMAND(ptr_hook, command), command) == 0) + if (strcmp (HOOK_COMMAND(ptr_hook, command), command) == 0) { if (ptr_hook->plugin == plugin) return ptr_hook; @@ -1498,15 +1498,15 @@ const char * gui_completion_get_string (struct t_gui_completion *completion, const char *property) { - if (completion) - { - if (string_strcmp (property, "base_command") == 0) - return completion->base_command; - else if (string_strcmp (property, "base_word") == 0) - return completion->base_word; - else if (string_strcmp (property, "args") == 0) - return completion->args; - } + if (!completion || !property) + return NULL; + + if (strcmp (property, "base_command") == 0) + return completion->base_command; + else if (strcmp (property, "base_word") == 0) + return completion->base_word; + else if (strcmp (property, "args") == 0) + return completion->args; return NULL; } diff --git a/src/gui/gui-layout.c b/src/gui/gui-layout.c index f7f9155d6..e72438161 100644 --- a/src/gui/gui-layout.c +++ b/src/gui/gui-layout.c @@ -264,7 +264,7 @@ gui_layout_buffer_get_number (struct t_gui_layout *layout, *layout_number = 0; *layout_number_merge_order = 0; - if (!layout) + if (!layout || !plugin_name || !buffer_name) return; old_number = -1; @@ -281,8 +281,8 @@ gui_layout_buffer_get_number (struct t_gui_layout *layout, else merge_order++; - if ((string_strcmp (ptr_layout_buffer->plugin_name, plugin_name) == 0) - && (string_strcmp (ptr_layout_buffer->buffer_name, buffer_name) == 0)) + if ((strcmp (ptr_layout_buffer->plugin_name, plugin_name) == 0) + && (strcmp (ptr_layout_buffer->buffer_name, buffer_name) == 0)) { *layout_number = ptr_layout_buffer->number; *layout_number_merge_order = merge_order; diff --git a/src/gui/gui-nicklist.c b/src/gui/gui-nicklist.c index 5b27fb5d0..6ce28fe90 100644 --- a/src/gui/gui-nicklist.c +++ b/src/gui/gui-nicklist.c @@ -838,13 +838,13 @@ gui_nicklist_group_get_integer (struct t_gui_buffer *buffer, /* make C compiler happy */ (void) buffer; - if (group && property) - { - if (string_strcmp (property, "visible") == 0) - return group->visible; - else if (string_strcmp (property, "level") == 0) - return group->level; - } + if (!group || !property) + return 0; + + if (strcmp (property, "visible") == 0) + return group->visible; + else if (strcmp (property, "level") == 0) + return group->level; return 0; } @@ -861,13 +861,13 @@ gui_nicklist_group_get_string (struct t_gui_buffer *buffer, /* make C compiler happy */ (void) buffer; - if (group && property) - { - if (string_strcmp (property, "name") == 0) - return group->name; - else if (string_strcmp (property, "color") == 0) - return group->color; - } + if (!group || !property) + return NULL; + + if (strcmp (property, "name") == 0) + return group->name; + else if (strcmp (property, "color") == 0) + return group->color; return NULL; } @@ -884,11 +884,11 @@ gui_nicklist_group_get_pointer (struct t_gui_buffer *buffer, /* make C compiler happy */ (void) buffer; - if (group && property) - { - if (string_strcmp (property, "parent") == 0) - return group->parent; - } + if (!group || !property) + return NULL; + + if (strcmp (property, "parent") == 0) + return group->parent; return NULL; } @@ -911,14 +911,14 @@ gui_nicklist_group_set (struct t_gui_buffer *buffer, group_changed = 0; - if (string_strcmp (property, "color") == 0) + if (strcmp (property, "color") == 0) { if (group->color) string_shared_free (group->color); group->color = (value[0]) ? (char *)string_shared_get (value) : NULL; group_changed = 1; } - else if (string_strcmp (property, "visible") == 0) + else if (strcmp (property, "visible") == 0) { error = NULL; number = strtol (value, &error, 10); @@ -947,11 +947,11 @@ gui_nicklist_nick_get_integer (struct t_gui_buffer *buffer, /* make C compiler happy */ (void) buffer; - if (nick && property) - { - if (string_strcmp (property, "visible") == 0) - return nick->visible; - } + if (!nick || !property) + return 0; + + if (strcmp (property, "visible") == 0) + return nick->visible; return 0; } @@ -968,17 +968,17 @@ gui_nicklist_nick_get_string (struct t_gui_buffer *buffer, /* make C compiler happy */ (void) buffer; - if (nick && property) - { - if (string_strcmp (property, "name") == 0) - return nick->name; - else if (string_strcmp (property, "color") == 0) - return nick->color; - else if (string_strcmp (property, "prefix") == 0) - return nick->prefix; - else if (string_strcmp (property, "prefix_color") == 0) - return nick->prefix_color; - } + if (!nick || !property) + return NULL; + + if (strcmp (property, "name") == 0) + return nick->name; + else if (strcmp (property, "color") == 0) + return nick->color; + else if (strcmp (property, "prefix") == 0) + return nick->prefix; + else if (strcmp (property, "prefix_color") == 0) + return nick->prefix_color; return NULL; } @@ -995,11 +995,11 @@ gui_nicklist_nick_get_pointer (struct t_gui_buffer *buffer, /* make C compiler happy */ (void) buffer; - if (nick && property) - { - if (string_strcmp (property, "group") == 0) - return nick->group; - } + if (!nick || !property) + return NULL; + + if (strcmp (property, "group") == 0) + return nick->group; return NULL; } @@ -1022,28 +1022,28 @@ gui_nicklist_nick_set (struct t_gui_buffer *buffer, nick_changed = 0; - if (string_strcmp (property, "color") == 0) + if (strcmp (property, "color") == 0) { if (nick->color) string_shared_free (nick->color); nick->color = (value[0]) ? (char *)string_shared_get (value) : NULL; nick_changed = 1; } - else if (string_strcmp (property, "prefix") == 0) + else if (strcmp (property, "prefix") == 0) { if (nick->prefix) string_shared_free (nick->prefix); nick->prefix = (value[0]) ? (char *)string_shared_get (value) : NULL; nick_changed = 1; } - else if (string_strcmp (property, "prefix_color") == 0) + else if (strcmp (property, "prefix_color") == 0) { if (nick->prefix_color) string_shared_free (nick->prefix_color); nick->prefix_color = (value[0]) ? (char *)string_shared_get (value) : NULL; nick_changed = 1; } - else if (string_strcmp (property, "visible") == 0) + else if (strcmp (property, "visible") == 0) { error = NULL; number = strtol (value, &error, 10); diff --git a/src/gui/gui-window.c b/src/gui/gui-window.c index 6abd65584..6cb8fc007 100644 --- a/src/gui/gui-window.c +++ b/src/gui/gui-window.c @@ -771,33 +771,33 @@ gui_window_get_integer (struct t_gui_window *window, const char *property) if (!window || !property) return 0; - if (string_strcmp (property, "number") == 0) + if (strcmp (property, "number") == 0) return window->number; - if (string_strcmp (property, "win_x") == 0) + if (strcmp (property, "win_x") == 0) return window->win_x; - if (string_strcmp (property, "win_y") == 0) + if (strcmp (property, "win_y") == 0) return window->win_y; - if (string_strcmp (property, "win_width") == 0) + if (strcmp (property, "win_width") == 0) return window->win_width; - if (string_strcmp (property, "win_height") == 0) + if (strcmp (property, "win_height") == 0) return window->win_height; - if (string_strcmp (property, "win_width_pct") == 0) + if (strcmp (property, "win_width_pct") == 0) return window->win_width_pct; - if (string_strcmp (property, "win_height_pct") == 0) + if (strcmp (property, "win_height_pct") == 0) return window->win_height_pct; - if (string_strcmp (property, "win_chat_x") == 0) + if (strcmp (property, "win_chat_x") == 0) return window->win_chat_x; - if (string_strcmp (property, "win_chat_y") == 0) + if (strcmp (property, "win_chat_y") == 0) return window->win_chat_y; - if (string_strcmp (property, "win_chat_width") == 0) + if (strcmp (property, "win_chat_width") == 0) return window->win_chat_width; - if (string_strcmp (property, "win_chat_height") == 0) + if (strcmp (property, "win_chat_height") == 0) return window->win_chat_height; - if (string_strcmp (property, "first_line_displayed") == 0) + if (strcmp (property, "first_line_displayed") == 0) return window->scroll->first_line_displayed; - if (string_strcmp (property, "scrolling") == 0) + if (strcmp (property, "scrolling") == 0) return window->scroll->scrolling; - if (string_strcmp (property, "lines_after") == 0) + if (strcmp (property, "lines_after") == 0) return window->scroll->lines_after; return 0; @@ -823,16 +823,16 @@ gui_window_get_string (struct t_gui_window *window, const char *property) void * gui_window_get_pointer (struct t_gui_window *window, const char *property) { - if (property) - { - if (string_strcmp (property, "current") == 0) - return gui_current_window; + if (!property) + return NULL; - if (window) - { - if (string_strcmp (property, "buffer") == 0) - return window->buffer; - } + if (strcmp (property, "current") == 0) + return gui_current_window; + + if (window) + { + if (strcmp (property, "buffer") == 0) + return window->buffer; } return NULL; diff --git a/src/plugins/exec/exec.c b/src/plugins/exec/exec.c index 2928883ef..be28473c8 100644 --- a/src/plugins/exec/exec.c +++ b/src/plugins/exec/exec.c @@ -65,7 +65,7 @@ exec_search_color (const char *color) for (i = 0; i < EXEC_NUM_COLORS; i++) { - if (weechat_strcmp (exec_color_string[i], color) == 0) + if (strcmp (exec_color_string[i], color) == 0) return i; } @@ -726,8 +726,7 @@ exec_debug_dump_cb (const void *pointer, void *data, (void) signal; (void) type_data; - if (!signal_data - || (weechat_strcmp ((char *)signal_data, EXEC_PLUGIN_NAME) == 0)) + if (!signal_data || (strcmp ((char *)signal_data, EXEC_PLUGIN_NAME) == 0)) { weechat_log_printf (""); weechat_log_printf ("***** \"%s\" plugin dump *****", diff --git a/src/plugins/fset/fset.c b/src/plugins/fset/fset.c index 1cd4c5f99..4f6be7f62 100644 --- a/src/plugins/fset/fset.c +++ b/src/plugins/fset/fset.c @@ -65,8 +65,7 @@ fset_debug_dump_cb (const void *pointer, void *data, (void) signal; (void) type_data; - if (!signal_data - || (weechat_strcmp ((char *)signal_data, FSET_PLUGIN_NAME) == 0)) + if (!signal_data || (strcmp ((char *)signal_data, FSET_PLUGIN_NAME) == 0)) { weechat_log_printf (""); weechat_log_printf ("***** \"%s\" plugin dump *****", diff --git a/src/plugins/guile/weechat-guile.c b/src/plugins/guile/weechat-guile.c index d851e09ee..48d9d3c67 100644 --- a/src/plugins/guile/weechat-guile.c +++ b/src/plugins/guile/weechat-guile.c @@ -1011,7 +1011,7 @@ weechat_guile_infolist_cb (const void *pointer, void *data, if (!infolist_name || !infolist_name[0]) return NULL; - if (weechat_strcmp (infolist_name, "guile_script") == 0) + if (strcmp (infolist_name, "guile_script") == 0) { return plugin_script_infolist_list_scripts (weechat_guile_plugin, guile_scripts, obj_pointer, @@ -1036,8 +1036,7 @@ weechat_guile_signal_debug_dump_cb (const void *pointer, void *data, (void) signal; (void) type_data; - if (!signal_data - || (weechat_strcmp ((char *)signal_data, GUILE_PLUGIN_NAME) == 0)) + if (!signal_data || (strcmp ((char *)signal_data, GUILE_PLUGIN_NAME) == 0)) { plugin_script_print_log (weechat_guile_plugin, guile_scripts); } diff --git a/src/plugins/irc/irc-debug.c b/src/plugins/irc/irc-debug.c index ea664dff7..7fc799266 100644 --- a/src/plugins/irc/irc-debug.c +++ b/src/plugins/irc/irc-debug.c @@ -45,8 +45,7 @@ irc_debug_signal_debug_dump_cb (const void *pointer, void *data, (void) signal; (void) type_data; - if (!signal_data - || (weechat_strcmp ((char *)signal_data, IRC_PLUGIN_NAME) == 0)) + if (!signal_data || (strcmp ((char *)signal_data, IRC_PLUGIN_NAME) == 0)) { weechat_log_printf (""); weechat_log_printf ("***** \"%s\" plugin dump *****", diff --git a/src/plugins/irc/irc-ignore.c b/src/plugins/irc/irc-ignore.c index 02202e995..82b98e0b3 100644 --- a/src/plugins/irc/irc-ignore.c +++ b/src/plugins/irc/irc-ignore.c @@ -180,7 +180,7 @@ irc_ignore_check_server (struct t_irc_ignore *ignore, const char *server) if (strcmp (ignore->server, "*") == 0) return 1; - return (weechat_strcmp (ignore->server, server) == 0) ? 1 : 0; + return (server && (strcmp (ignore->server, server) == 0)) ? 1 : 0; } /* diff --git a/src/plugins/javascript/weechat-js.cpp b/src/plugins/javascript/weechat-js.cpp index 75821b5cc..cda9f5aad 100644 --- a/src/plugins/javascript/weechat-js.cpp +++ b/src/plugins/javascript/weechat-js.cpp @@ -794,7 +794,7 @@ weechat_js_infolist_cb (const void *pointer, void *data, if (!infolist_name || !infolist_name[0]) return NULL; - if (weechat_strcmp (infolist_name, "javascript_script") == 0) + if (strcmp (infolist_name, "javascript_script") == 0) { return plugin_script_infolist_list_scripts (weechat_js_plugin, js_scripts, obj_pointer, @@ -819,8 +819,7 @@ weechat_js_signal_debug_dump_cb (const void *pointer, void *data, (void) signal; (void) type_data; - if (!signal_data - || (weechat_strcmp ((char *)signal_data, JS_PLUGIN_NAME) == 0)) + if (!signal_data || (strcmp ((char *)signal_data, JS_PLUGIN_NAME) == 0)) { plugin_script_print_log (weechat_js_plugin, js_scripts); } diff --git a/src/plugins/lua/weechat-lua.c b/src/plugins/lua/weechat-lua.c index f42d0b70e..c90b4d64e 100644 --- a/src/plugins/lua/weechat-lua.c +++ b/src/plugins/lua/weechat-lua.c @@ -1110,7 +1110,7 @@ weechat_lua_infolist_cb (const void *pointer, void *data, if (!infolist_name || !infolist_name[0]) return NULL; - if (weechat_strcmp (infolist_name, "lua_script") == 0) + if (strcmp (infolist_name, "lua_script") == 0) { return plugin_script_infolist_list_scripts (weechat_lua_plugin, lua_scripts, obj_pointer, @@ -1135,8 +1135,7 @@ weechat_lua_signal_debug_dump_cb (const void *pointer, void *data, (void) signal; (void) type_data; - if (!signal_data - || (weechat_strcmp ((char *)signal_data, LUA_PLUGIN_NAME) == 0)) + if (!signal_data || (strcmp ((char *)signal_data, LUA_PLUGIN_NAME) == 0)) { plugin_script_print_log (weechat_lua_plugin, lua_scripts); } diff --git a/src/plugins/perl/weechat-perl.c b/src/plugins/perl/weechat-perl.c index bfad79d61..063fe75bd 100644 --- a/src/plugins/perl/weechat-perl.c +++ b/src/plugins/perl/weechat-perl.c @@ -1093,7 +1093,7 @@ weechat_perl_infolist_cb (const void *pointer, void *data, if (!infolist_name || !infolist_name[0]) return NULL; - if (weechat_strcmp (infolist_name, "perl_script") == 0) + if (strcmp (infolist_name, "perl_script") == 0) { return plugin_script_infolist_list_scripts (weechat_perl_plugin, perl_scripts, obj_pointer, @@ -1118,8 +1118,7 @@ weechat_perl_signal_debug_dump_cb (const void *pointer, void *data, (void) signal; (void) type_data; - if (!signal_data - || (weechat_strcmp ((char *)signal_data, PERL_PLUGIN_NAME) == 0)) + if (!signal_data || (strcmp ((char *)signal_data, PERL_PLUGIN_NAME) == 0)) { plugin_script_print_log (weechat_perl_plugin, perl_scripts); } diff --git a/src/plugins/php/weechat-php.c b/src/plugins/php/weechat-php.c index ac2cbc508..3f85b06fd 100644 --- a/src/plugins/php/weechat-php.c +++ b/src/plugins/php/weechat-php.c @@ -1113,7 +1113,7 @@ weechat_php_infolist_cb (const void *pointer, void *data, if (!infolist_name || !infolist_name[0]) return NULL; - if (weechat_strcmp (infolist_name, "php_script") == 0) + if (strcmp (infolist_name, "php_script") == 0) { return plugin_script_infolist_list_scripts (weechat_php_plugin, php_scripts, obj_pointer, @@ -1138,8 +1138,7 @@ weechat_php_signal_debug_dump_cb (const void *pointer, void *data, (void) signal; (void) type_data; - if (!signal_data - || (weechat_strcmp ((char *)signal_data, PHP_PLUGIN_NAME) == 0)) + if (!signal_data || (strcmp ((char *)signal_data, PHP_PLUGIN_NAME) == 0)) { plugin_script_print_log (weechat_php_plugin, php_scripts); } diff --git a/src/plugins/plugin.c b/src/plugins/plugin.c index 964347d26..1e9040bba 100644 --- a/src/plugins/plugin.c +++ b/src/plugins/plugin.c @@ -128,7 +128,7 @@ plugin_search (const char *name) for (ptr_plugin = weechat_plugins; ptr_plugin; ptr_plugin = ptr_plugin->next_plugin) { - if (string_strcmp (ptr_plugin->name, name) == 0) + if (strcmp (ptr_plugin->name, name) == 0) return ptr_plugin; } @@ -166,14 +166,17 @@ plugin_check_extension_allowed (const char *filename) if (!config_plugin_extensions) return 1; + if (!filename) + return 0; + length = strlen (filename); for (i = 0; i < config_num_plugin_extensions; i++) { length_ext = strlen (config_plugin_extensions[i]); if (length >= length_ext) { - if (string_strcmp (filename + length - length_ext, - config_plugin_extensions[i]) == 0) + if (strcmp (filename + length - length_ext, + config_plugin_extensions[i]) == 0) { /* extension allowed */ return 1; @@ -235,8 +238,8 @@ plugin_check_autoload (const char *filename) length_ext = strlen (config_plugin_extensions[i]); if (length >= length_ext) { - if (string_strcmp (base_name + length - length_ext, - config_plugin_extensions[i]) == 0) + if (strcmp (base_name + length - length_ext, + config_plugin_extensions[i]) == 0) { plugin_name = string_strndup (base_name, length - length_ext); break; diff --git a/src/plugins/python/weechat-python.c b/src/plugins/python/weechat-python.c index 94a7d9e95..c06b4eb43 100644 --- a/src/plugins/python/weechat-python.c +++ b/src/plugins/python/weechat-python.c @@ -1336,7 +1336,7 @@ weechat_python_infolist_cb (const void *pointer, void *data, if (!infolist_name || !infolist_name[0]) return NULL; - if (weechat_strcmp (infolist_name, "python_script") == 0) + if (strcmp (infolist_name, "python_script") == 0) { return plugin_script_infolist_list_scripts (weechat_python_plugin, python_scripts, @@ -1362,8 +1362,7 @@ weechat_python_signal_debug_dump_cb (const void *pointer, void *data, (void) signal; (void) type_data; - if (!signal_data - || (weechat_strcmp ((char *)signal_data, PYTHON_PLUGIN_NAME) == 0)) + if (!signal_data || (strcmp ((char *)signal_data, PYTHON_PLUGIN_NAME) == 0)) { plugin_script_print_log (weechat_python_plugin, python_scripts); } diff --git a/src/plugins/relay/relay.c b/src/plugins/relay/relay.c index 429bc5a54..0677c7e8b 100644 --- a/src/plugins/relay/relay.c +++ b/src/plugins/relay/relay.c @@ -173,8 +173,7 @@ relay_debug_dump_cb (const void *pointer, void *data, (void) signal; (void) type_data; - if (!signal_data - || (weechat_strcmp ((char *)signal_data, RELAY_PLUGIN_NAME) == 0)) + if (!signal_data || (strcmp ((char *)signal_data, RELAY_PLUGIN_NAME) == 0)) { weechat_log_printf (""); weechat_log_printf ("***** \"%s\" plugin dump *****", diff --git a/src/plugins/ruby/weechat-ruby.c b/src/plugins/ruby/weechat-ruby.c index 1ce7da62b..a629437c9 100644 --- a/src/plugins/ruby/weechat-ruby.c +++ b/src/plugins/ruby/weechat-ruby.c @@ -1147,7 +1147,7 @@ weechat_ruby_infolist_cb (const void *pointer, void *data, if (!infolist_name || !infolist_name[0]) return NULL; - if (weechat_strcmp (infolist_name, "ruby_script") == 0) + if (strcmp (infolist_name, "ruby_script") == 0) { return plugin_script_infolist_list_scripts (weechat_ruby_plugin, ruby_scripts, obj_pointer, @@ -1172,8 +1172,7 @@ weechat_ruby_signal_debug_dump_cb (const void *pointer, void *data, (void) signal; (void) type_data; - if (!signal_data - || (weechat_strcmp ((char *)signal_data, RUBY_PLUGIN_NAME) == 0)) + if (!signal_data || (strcmp ((char *)signal_data, RUBY_PLUGIN_NAME) == 0)) { plugin_script_print_log (weechat_ruby_plugin, ruby_scripts); } diff --git a/src/plugins/script/script.c b/src/plugins/script/script.c index 553ac3765..67636e0f4 100644 --- a/src/plugins/script/script.c +++ b/src/plugins/script/script.c @@ -249,8 +249,7 @@ script_debug_dump_cb (const void *pointer, void *data, (void) signal; (void) type_data; - if (!signal_data - || (weechat_strcmp ((char *)signal_data, SCRIPT_PLUGIN_NAME) == 0)) + if (!signal_data || (strcmp ((char *)signal_data, SCRIPT_PLUGIN_NAME) == 0)) { weechat_log_printf (""); weechat_log_printf ("***** \"%s\" plugin dump *****", diff --git a/src/plugins/spell/spell.c b/src/plugins/spell/spell.c index 88fd1e04d..68d96ec9a 100644 --- a/src/plugins/spell/spell.c +++ b/src/plugins/spell/spell.c @@ -351,7 +351,7 @@ spell_command_authorized (const char *command) for (i = 0; i < spell_count_commands_to_check; i++) { if ((spell_length_commands_to_check[i] == length_command) - && (weechat_strcmp (command, spell_commands_to_check[i]) == 0)) + && (strcmp (command, spell_commands_to_check[i]) == 0)) { /* command is authorized */ return 1; diff --git a/src/plugins/tcl/weechat-tcl.c b/src/plugins/tcl/weechat-tcl.c index 79d0a5243..bc22e7127 100644 --- a/src/plugins/tcl/weechat-tcl.c +++ b/src/plugins/tcl/weechat-tcl.c @@ -795,7 +795,7 @@ weechat_tcl_infolist_cb (const void *pointer, void *data, if (!infolist_name || !infolist_name[0]) return NULL; - if (weechat_strcmp (infolist_name, "tcl_script") == 0) + if (strcmp (infolist_name, "tcl_script") == 0) { return plugin_script_infolist_list_scripts (weechat_tcl_plugin, tcl_scripts, obj_pointer, @@ -820,8 +820,7 @@ weechat_tcl_signal_debug_dump_cb (const void *pointer, void *data, (void) signal; (void) type_data; - if (!signal_data - || (weechat_strcmp ((char *)signal_data, TCL_PLUGIN_NAME) == 0)) + if (!signal_data || (strcmp ((char *)signal_data, TCL_PLUGIN_NAME) == 0)) { plugin_script_print_log (weechat_tcl_plugin, tcl_scripts); } diff --git a/src/plugins/trigger/trigger.c b/src/plugins/trigger/trigger.c index 8ea464c3e..cc71a5af0 100644 --- a/src/plugins/trigger/trigger.c +++ b/src/plugins/trigger/trigger.c @@ -1362,8 +1362,7 @@ trigger_debug_dump_cb (const void *pointer, void *data, (void) signal; (void) type_data; - if (!signal_data - || (weechat_strcmp ((char *)signal_data, TRIGGER_PLUGIN_NAME) == 0)) + if (!signal_data || (strcmp ((char *)signal_data, TRIGGER_PLUGIN_NAME) == 0)) { weechat_log_printf (""); weechat_log_printf ("***** \"%s\" plugin dump *****", diff --git a/src/plugins/xfer/xfer.c b/src/plugins/xfer/xfer.c index 497e4af53..01297e47d 100644 --- a/src/plugins/xfer/xfer.c +++ b/src/plugins/xfer/xfer.c @@ -244,15 +244,18 @@ xfer_search_protocol (const char *protocol) */ struct t_xfer * -xfer_search (const char *plugin_name, const char *plugin_id, enum t_xfer_type type, - enum t_xfer_status status, int port) +xfer_search (const char *plugin_name, const char *plugin_id, + enum t_xfer_type type, enum t_xfer_status status, int port) { struct t_xfer *ptr_xfer; + if (!plugin_name || !plugin_id) + return NULL; + for (ptr_xfer = xfer_list; ptr_xfer; ptr_xfer = ptr_xfer->next_xfer) { - if ((weechat_strcmp (ptr_xfer->plugin_name, plugin_name) == 0) - && (weechat_strcmp (ptr_xfer->plugin_id, plugin_id) == 0) + if ((strcmp (ptr_xfer->plugin_name, plugin_name) == 0) + && (strcmp (ptr_xfer->plugin_id, plugin_id) == 0) && (ptr_xfer->type == type) && (ptr_xfer->status = status) && (ptr_xfer->port == port)) @@ -1759,8 +1762,7 @@ xfer_debug_dump_cb (const void *pointer, void *data, (void) signal; (void) type_data; - if (!signal_data - || (weechat_strcmp ((char *)signal_data, XFER_PLUGIN_NAME) == 0)) + if (!signal_data || (strcmp ((char *)signal_data, XFER_PLUGIN_NAME) == 0)) { weechat_log_printf (""); weechat_log_printf ("***** \"%s\" plugin dump *****", |