[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.86 and 1.87

version 1.86, 2019/12/26 11:04:58 version 1.87, 2020/05/16 14:49:50
Line 23 
Line 23 
 #include <string.h>  #include <string.h>
 #include <stdlib.h>  #include <stdlib.h>
 #include <unistd.h>  #include <unistd.h>
   #include <vis.h>
 #include <time.h>  #include <time.h>
   
 #include "tmux.h"  #include "tmux.h"
Line 123 
Line 124 
   
         s->cwd = xstrdup(cwd);          s->cwd = xstrdup(cwd);
   
         s->curw = NULL;  
         TAILQ_INIT(&s->lastw);          TAILQ_INIT(&s->lastw);
         RB_INIT(&s->windows);          RB_INIT(&s->windows);
   
Line 142 
Line 142 
                 s->name = xstrdup(name);                  s->name = xstrdup(name);
                 s->id = next_session_id++;                  s->id = next_session_id++;
         } else {          } else {
                 s->name = NULL;  
                 do {                  do {
                         s->id = next_session_id++;                          s->id = next_session_id++;
                         free(s->name);                          free(s->name);
Line 232 
Line 231 
         session_remove_ref(s, __func__);          session_remove_ref(s, __func__);
 }  }
   
 /* Check a session name is valid: not empty and no colons or periods. */  /* Sanitize session name. */
 int  char *
 session_check_name(const char *name)  session_check_name(const char *name)
 {  {
         return (*name != '\0' && name[strcspn(name, ":.")] == '\0');          char    *copy, *cp, *new_name;
   
           copy = xstrdup(name);
           for (cp = copy; *cp != '\0'; cp++) {
                   if (*cp == ':' || *cp == '.')
                           *cp = '_';
           }
           utf8_stravis(&new_name, copy, VIS_OCTAL|VIS_CSTYLE|VIS_TAB|VIS_NL);
           free(copy);
           return (new_name);
 }  }
   
 /* Lock session if it has timed out. */  /* Lock session if it has timed out. */
Line 556 
Line 564 
         TAILQ_REMOVE(&sg->sessions, s, gentry);          TAILQ_REMOVE(&sg->sessions, s, gentry);
         if (TAILQ_EMPTY(&sg->sessions)) {          if (TAILQ_EMPTY(&sg->sessions)) {
                 RB_REMOVE(session_groups, &session_groups, sg);                  RB_REMOVE(session_groups, &session_groups, sg);
                   free((void *)sg->name);
                 free(sg);                  free(sg);
         }          }
 }  }

Legend:
Removed from v.1.86  
changed lines
  Added in v.1.87