Revision: 2696
          http://tmux.svn.sourceforge.net/tmux/?rev=2696&view=rev
Author:   tcunha
Date:     2012-02-02 02:00:12 +0000 (Thu, 02 Feb 2012)
Log Message:
-----------
Sync OpenBSD patchset 1024:

Move window name changes into wrapper function window_set_name, from
George Nachman.

Modified Paths:
--------------
    trunk/cmd-break-pane.c
    trunk/cmd-new-session.c
    trunk/cmd-rename-window.c
    trunk/input.c
    trunk/tmux.h
    trunk/window.c

Modified: trunk/cmd-break-pane.c
===================================================================
--- trunk/cmd-break-pane.c      2012-02-02 01:58:47 UTC (rev 2695)
+++ trunk/cmd-break-pane.c      2012-02-02 02:00:12 UTC (rev 2696)
@@ -46,6 +46,7 @@
        struct session          *s;
        struct window_pane      *wp;
        struct window           *w;
+       char                    *name;
        char                    *cause;
        int                      base_idx;
 
@@ -74,7 +75,9 @@
        w = wp->window = window_create1(s->sx, s->sy);
        TAILQ_INSERT_HEAD(&w->panes, wp, entry);
        w->active = wp;
-       w->name = default_window_name(w);
+       name = default_window_name(w);
+       window_set_name(w, name);
+       xfree(name);
        layout_init(w);
 
        base_idx = options_get_number(&s->options, "base-index");

Modified: trunk/cmd-new-session.c
===================================================================
--- trunk/cmd-new-session.c     2012-02-02 01:58:47 UTC (rev 2695)
+++ trunk/cmd-new-session.c     2012-02-02 02:00:12 UTC (rev 2696)
@@ -217,8 +217,7 @@
        if (cmd != NULL && args_has(args, 'n')) {
                w = s->curw->window;
 
-               xfree(w->name);
-               w->name = xstrdup(args_get(args, 'n'));
+               window_set_name(w, args_get(args, 'n'));
 
                options_set_number(&w->options, "automatic-rename", 0);
        }

Modified: trunk/cmd-rename-window.c
===================================================================
--- trunk/cmd-rename-window.c   2012-02-02 01:58:47 UTC (rev 2695)
+++ trunk/cmd-rename-window.c   2012-02-02 02:00:12 UTC (rev 2696)
@@ -48,8 +48,7 @@
        if ((wl = cmd_find_window(ctx, args_get(args, 't'), &s)) == NULL)
                return (-1);
 
-       xfree(wl->window->name);
-       wl->window->name = xstrdup(args->argv[0]);
+       window_set_name(wl->window, args->argv[0]);
        options_set_number(&wl->window->options, "automatic-rename", 0);
 
        server_status_window(wl->window);

Modified: trunk/input.c
===================================================================
--- trunk/input.c       2012-02-02 01:58:47 UTC (rev 2695)
+++ trunk/input.c       2012-02-02 02:00:12 UTC (rev 2696)
@@ -1552,8 +1552,7 @@
                return;
        log_debug("%s: \"%s\"", __func__, ictx->input_buf);
 
-       xfree(ictx->wp->window->name);
-       ictx->wp->window->name = xstrdup(ictx->input_buf);
+       window_set_name(ictx->wp->window, ictx->input_buf);
        options_set_number(&ictx->wp->window->options, "automatic-rename", 0);
 
        server_status_window(ictx->wp->window);

Modified: trunk/tmux.h
===================================================================
--- trunk/tmux.h        2012-02-02 01:58:47 UTC (rev 2695)
+++ trunk/tmux.h        2012-02-02 02:00:12 UTC (rev 2696)
@@ -1964,6 +1964,7 @@
 struct window_pane *window_pane_find_down(struct window_pane *);
 struct window_pane *window_pane_find_left(struct window_pane *);
 struct window_pane *window_pane_find_right(struct window_pane *);
+void            window_set_name(struct window *, const char *);
 
 /* layout.c */
 u_int           layout_count_cells(struct layout_cell *);

Modified: trunk/window.c
===================================================================
--- trunk/window.c      2012-02-02 01:58:47 UTC (rev 2695)
+++ trunk/window.c      2012-02-02 02:00:12 UTC (rev 2696)
@@ -359,6 +359,14 @@
 }
 
 void
+window_set_name(struct window *w, const char *new_name)
+{
+       if (w->name != NULL)
+               xfree(w->name);
+       w->name = xstrdup(new_name);
+}
+
+void
 window_resize(struct window *w, u_int sx, u_int sy)
 {
        w->sx = sx;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs

Reply via email to