Skip to content

Commit

Permalink
core: rename nick color hash seed to salt to be more accurate
Browse files Browse the repository at this point in the history
  • Loading branch information
sim642 committed Jul 21, 2018
1 parent 0664f74 commit 88d041e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/core/wee-config.c
Expand Up @@ -152,7 +152,7 @@ struct t_config_option *config_look_mouse;
struct t_config_option *config_look_mouse_timer_delay;
struct t_config_option *config_look_nick_color_force;
struct t_config_option *config_look_nick_color_hash;
struct t_config_option *config_look_nick_color_hash_seed;
struct t_config_option *config_look_nick_color_hash_salt;
struct t_config_option *config_look_nick_color_stop_chars;
struct t_config_option *config_look_nick_prefix;
struct t_config_option *config_look_nick_suffix;
Expand Down Expand Up @@ -3142,10 +3142,10 @@ config_weechat_init_options ()
"different color), sum = sum of letters"),
"djb2|sum", 0, 0, "djb2", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
config_look_nick_color_hash_seed = config_file_new_option (
config_look_nick_color_hash_salt = config_file_new_option (
weechat_config_file, ptr_section,
"nick_color_hash_seed", "string",
N_("seed to be used with the hash algorithm used for nick colors; "
"nick_color_hash_salt", "string",
N_("salt to be used with the hash algorithm used for nick colors; "
"modifying this shuffles nick colors"),
NULL, 0, 0, "", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
Expand Down
2 changes: 1 addition & 1 deletion src/core/wee-config.h
Expand Up @@ -203,7 +203,7 @@ extern struct t_config_option *config_look_mouse;
extern struct t_config_option *config_look_mouse_timer_delay;
extern struct t_config_option *config_look_nick_color_force;
extern struct t_config_option *config_look_nick_color_hash;
extern struct t_config_option *config_look_nick_color_hash_seed;
extern struct t_config_option *config_look_nick_color_hash_salt;
extern struct t_config_option *config_look_nick_color_stop_chars;
extern struct t_config_option *config_look_nick_prefix;
extern struct t_config_option *config_look_nick_suffix;
Expand Down
8 changes: 4 additions & 4 deletions src/gui/gui-nick.c
Expand Up @@ -59,16 +59,16 @@ gui_nick_hash_color (const char *nickname)
if (config_num_nick_colors == 0)
return 0;

/* avoid unnecessary allocation and string operations with empty seed */
if (CONFIG_STRING(config_look_nick_color_hash_seed))
/* avoid unnecessary allocation and string operations with empty salt */
if (CONFIG_STRING(config_look_nick_color_hash_salt))
{
length = strlen (CONFIG_STRING(config_look_nick_color_hash_seed)) +
length = strlen (CONFIG_STRING(config_look_nick_color_hash_salt)) +
strlen (nickname) + 1;
str = malloc (length);
if (str)
{
snprintf (str, length, "%s%s",
CONFIG_STRING(config_look_nick_color_hash_seed),
CONFIG_STRING(config_look_nick_color_hash_salt),
nickname);
ptr_nick = str;
}
Expand Down

0 comments on commit 88d041e

Please sign in to comment.