summaryrefslogtreecommitdiff
path: root/src/gui/gui-buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/gui-buffer.c')
-rw-r--r--src/gui/gui-buffer.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c
index 669e16a90..ae3e82d88 100644
--- a/src/gui/gui-buffer.c
+++ b/src/gui/gui-buffer.c
@@ -1294,6 +1294,10 @@ gui_buffer_set_name (struct t_gui_buffer *buffer, const char *name)
if (!buffer || !name || !name[0])
return;
+ /* same name? */
+ if (buffer->name && (strcmp (buffer->name, name) == 0))
+ return;
+
if (buffer->name)
free (buffer->name);
buffer->name = strdup (name);
@@ -1315,6 +1319,14 @@ gui_buffer_set_short_name (struct t_gui_buffer *buffer, const char *short_name)
if (!buffer)
return;
+ /* same short name? */
+ if ((!buffer->short_name && !short_name)
+ || (buffer->short_name && short_name
+ && (strcmp (buffer->short_name, short_name) == 0)))
+ {
+ return;
+ }
+
if (buffer->short_name)
{
free (buffer->short_name);
@@ -1338,7 +1350,11 @@ gui_buffer_set_short_name (struct t_gui_buffer *buffer, const char *short_name)
void
gui_buffer_set_type (struct t_gui_buffer *buffer, enum t_gui_buffer_type type)
{
- if (!buffer || (buffer->type == type))
+ if (!buffer)
+ return;
+
+ /* same type? */
+ if (buffer->type == type)
return;
gui_line_free_all (buffer);
@@ -1363,6 +1379,14 @@ gui_buffer_set_title (struct t_gui_buffer *buffer, const char *new_title)
if (!buffer)
return;
+ /* same title? */
+ if ((!buffer->title && !new_title)
+ || (buffer->title && new_title
+ && (strcmp (buffer->title, new_title) == 0)))
+ {
+ return;
+ }
+
if (buffer->title)
free (buffer->title);
buffer->title = (new_title && new_title[0]) ? strdup (new_title) : NULL;