[BACK]Return to session.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Diff for /src/usr.bin/tmux/session.c between version 1.49 and 1.50

version 1.49, 2015/05/06 08:35:39 version 1.50, 2015/06/05 18:18:32
Line 27 
Line 27 
   
 #include "tmux.h"  #include "tmux.h"
   
 /* Global session list. */  
 struct sessions sessions;  struct sessions sessions;
 struct sessions dead_sessions;  
 u_int           next_session_id;  u_int           next_session_id;
 struct session_groups session_groups;  struct session_groups session_groups;
   
   void    session_free(int, short, void *);
   
 struct winlink *session_next_alert(struct winlink *);  struct winlink *session_next_alert(struct winlink *);
 struct winlink *session_previous_alert(struct winlink *);  struct winlink *session_previous_alert(struct winlink *);
   
Line 109 
Line 109 
         struct winlink  *wl;          struct winlink  *wl;
   
         s = xmalloc(sizeof *s);          s = xmalloc(sizeof *s);
         s->references = 0;          s->references = 1;
         s->flags = 0;          s->flags = 0;
   
         if (gettimeofday(&s->creation_time, NULL) != 0)          if (gettimeofday(&s->creation_time, NULL) != 0)
Line 164 
Line 164 
         return (s);          return (s);
 }  }
   
   /* Remove a reference from a session. */
   void
   session_unref(struct session *s)
   {
           log_debug("session %s has %d references", s->name, s->references);
   
           s->references--;
           if (s->references == 0)
                   event_once(-1, EV_TIMEOUT, session_free, s, NULL);
   }
   
   /* Free session. */
   void
   session_free(unused int fd, unused short events, void *arg)
   {
           struct session  *s = arg;
   
           log_debug("sesson %s freed (%d references)", s->name, s->references);
   
           if (s->references == 0)
                   free(s);
   }
   
 /* Destroy a session. */  /* Destroy a session. */
 void  void
 session_destroy(struct session *s)  session_destroy(struct session *s)
Line 191 
Line 214 
   
         close(s->cwd);          close(s->cwd);
   
         RB_INSERT(sessions, &dead_sessions, s);          session_unref(s);
 }  }
   
 /* Check a session name is valid: not empty and no colons or periods. */  /* Check a session name is valid: not empty and no colons or periods. */

Legend:
Removed from v.1.49  
changed lines
  Added in v.1.50