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

Diff for /src/usr.bin/tmux/format.c between version 1.281 and 1.282

version 1.281, 2021/03/02 10:56:45 version 1.282, 2021/03/11 07:08:18
Line 41 
Line 41 
 struct format_expand_state;  struct format_expand_state;
   
 static char     *format_job_get(struct format_expand_state *, const char *);  static char     *format_job_get(struct format_expand_state *, const char *);
 static void      format_job_timer(int, short, void *);  
 static char     *format_expand1(struct format_expand_state *, const char *);  static char     *format_expand1(struct format_expand_state *, const char *);
 static int       format_replace(struct format_expand_state *, const char *,  static int       format_replace(struct format_expand_state *, const char *,
                      size_t, char **, size_t *, size_t *);                       size_t, char **, size_t *, size_t *);
Line 69 
Line 68 
 };  };
   
 /* Format job tree. */  /* Format job tree. */
 static struct event format_job_event;  
 static int format_job_cmp(struct format_job *, struct format_job *);  static int format_job_cmp(struct format_job *, struct format_job *);
 static RB_HEAD(format_job_tree, format_job) format_jobs = RB_INITIALIZER();  static RB_HEAD(format_job_tree, format_job) format_jobs = RB_INITIALIZER();
 RB_GENERATE_STATIC(format_job_tree, format_job, entry, format_job_cmp);  RB_GENERATE_STATIC(format_job_tree, format_job, entry, format_job_cmp);
Line 437 
Line 435 
         }          }
 }  }
   
 /* Remove old jobs for client. */  /* Tidy old jobs for all clients. */
 void  void
 format_lost_client(struct client *c)  format_tidy_jobs(void)
 {  {
         if (c->jobs != NULL)  
                 format_job_tidy(c->jobs, 1);  
         free(c->jobs);  
 }  
   
 /* Remove old jobs periodically. */  
 static void  
 format_job_timer(__unused int fd, __unused short events, __unused void *arg)  
 {  
         struct client   *c;          struct client   *c;
         struct timeval   tv = { .tv_sec = 60 };  
   
         format_job_tidy(&format_jobs, 0);          format_job_tidy(&format_jobs, 0);
         TAILQ_FOREACH(c, &clients, entry) {          TAILQ_FOREACH(c, &clients, entry) {
                 if (c->jobs != NULL)                  if (c->jobs != NULL)
                         format_job_tidy(c->jobs, 0);                          format_job_tidy(c->jobs, 0);
         }          }
   }
   
         evtimer_del(&format_job_event);  /* Remove old jobs for client. */
         evtimer_add(&format_job_event, &tv);  void
   format_lost_client(struct client *c)
   {
           if (c->jobs != NULL)
                   format_job_tidy(c->jobs, 1);
           free(c->jobs);
 }  }
   
 /* Wrapper for asprintf. */  /* Wrapper for asprintf. */
Line 3047 
Line 3041 
 format_create(struct client *c, struct cmdq_item *item, int tag, int flags)  format_create(struct client *c, struct cmdq_item *item, int tag, int flags)
 {  {
         struct format_tree      *ft;          struct format_tree      *ft;
   
         if (!event_initialized(&format_job_event)) {  
                 evtimer_set(&format_job_event, format_job_timer, NULL);  
                 format_job_timer(-1, 0, NULL);  
         }  
   
         ft = xcalloc(1, sizeof *ft);          ft = xcalloc(1, sizeof *ft);
         RB_INIT(&ft->tree);          RB_INIT(&ft->tree);

Legend:
Removed from v.1.281  
changed lines
  Added in v.1.282