summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/curses/gui-curses-color.c16
-rw-r--r--src/gui/gui-bar-item.c6
2 files changed, 5 insertions, 17 deletions
diff --git a/src/gui/curses/gui-curses-color.c b/src/gui/curses/gui-curses-color.c
index c9fb155f9..dfd8ad5ec 100644
--- a/src/gui/curses/gui-curses-color.c
+++ b/src/gui/curses/gui-curses-color.c
@@ -614,8 +614,6 @@ gui_color_build (int number, int foreground, int background)
void
gui_color_init_vars ()
{
- int size;
-
gui_color_term_has_colors = (has_colors ()) ? 1 : 0;
gui_color_term_colors = 0;
gui_color_term_color_pairs = 0;
@@ -637,12 +635,9 @@ gui_color_init_vars ()
/* TODO: ncurses may support 65536, but short type used for pairs supports only 32768? */
gui_color_num_pairs = (gui_color_term_color_pairs >= 32768) ?
32767 : gui_color_term_color_pairs - 1;
- size = (gui_color_term_colors + 2)
- * (gui_color_term_colors + 2)
- * sizeof (gui_color_pairs[0]);
- gui_color_pairs = malloc (size);
- if (gui_color_pairs)
- memset (gui_color_pairs, 0, size);
+ gui_color_pairs = calloc (
+ (gui_color_term_colors + 2) * (gui_color_term_colors + 2),
+ sizeof (gui_color_pairs[0]));
gui_color_pairs_used = 0;
/* reserved for future usage */
@@ -667,10 +662,7 @@ gui_color_init_vars ()
gui_color_term_color_pairs = 1;
gui_color_term_can_change_color = 0;
gui_color_num_pairs = 1;
- size = sizeof (gui_color_pairs[0]);
- gui_color_pairs = malloc (size);
- if (gui_color_pairs)
- memset (gui_color_pairs, 0, size);
+ gui_color_pairs = calloc (1, sizeof (gui_color_pairs[0]));
gui_color_pairs_used = 0;
}
}
diff --git a/src/gui/gui-bar-item.c b/src/gui/gui-bar-item.c
index 7974f1910..1390cee2a 100644
--- a/src/gui/gui-bar-item.c
+++ b/src/gui/gui-bar-item.c
@@ -1440,11 +1440,7 @@ gui_bar_item_hotlist_cb (const void *pointer, void *data,
buffer_without_name_displayed = NULL;
if (CONFIG_BOOLEAN(config_look_hotlist_unique_numbers) && last_gui_buffer)
- {
- buffer_without_name_displayed = malloc (last_gui_buffer->number);
- if (buffer_without_name_displayed)
- memset (buffer_without_name_displayed, 0, last_gui_buffer->number);
- }
+ buffer_without_name_displayed = calloc (last_gui_buffer->number, 1);
numbers_count = 0;
names_count = 0;