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

Diff for /src/usr.bin/tmux/cmd-queue.c between version 1.89 and 1.90

version 1.89, 2020/04/13 20:51:57 version 1.90, 2020/04/14 06:00:52
Line 64 
Line 64 
   
         TAILQ_ENTRY(cmdq_item)   entry;          TAILQ_ENTRY(cmdq_item)   entry;
 };  };
 TAILQ_HEAD(cmdq_list, cmdq_item);  TAILQ_HEAD(cmdq_item_list, cmdq_item);
   
 /*  /*
  * Command queue state. This is the context for commands on the command queue.   * Command queue state. This is the context for commands on the command queue.
Line 83 
Line 83 
         struct cmd_find_state    current;          struct cmd_find_state    current;
 };  };
   
   /* Command queue. */
   struct cmdq_list {
           struct cmdq_item        *item;
           struct cmdq_item_list    list;
   };
   
 /* Get command queue name. */  /* Get command queue name. */
 static const char *  static const char *
 cmdq_name(struct client *c)  cmdq_name(struct client *c)
Line 119 
Line 125 
         struct cmdq_list        *queue;          struct cmdq_list        *queue;
   
         queue = xcalloc (1, sizeof *queue);          queue = xcalloc (1, sizeof *queue);
         TAILQ_INIT (queue);          TAILQ_INIT (&queue->list);
         return (queue);          return (queue);
 }  }
   
Line 127 
Line 133 
 void  void
 cmdq_free(struct cmdq_list *queue)  cmdq_free(struct cmdq_list *queue)
 {  {
         if (!TAILQ_EMPTY(queue))          if (!TAILQ_EMPTY(&queue->list))
                 fatalx("queue not empty");                  fatalx("queue not empty");
         free(queue);          free(queue);
 }  }
Line 289 
Line 295 
                 item->client = c;                  item->client = c;
   
                 item->queue = queue;                  item->queue = queue;
                 TAILQ_INSERT_TAIL(queue, item, entry);                  TAILQ_INSERT_TAIL(&queue->list, item, entry);
                 log_debug("%s %s: %s", __func__, cmdq_name(c), item->name);                  log_debug("%s %s: %s", __func__, cmdq_name(c), item->name);
   
                 item = next;                  item = next;
         } while (item != NULL);          } while (item != NULL);
         return (TAILQ_LAST(queue, cmdq_list));          return (TAILQ_LAST(&queue->list, cmdq_item_list));
 }  }
   
 /* Insert an item. */  /* Insert an item. */
Line 315 
Line 321 
                 item->client = c;                  item->client = c;
   
                 item->queue = queue;                  item->queue = queue;
                 TAILQ_INSERT_AFTER(queue, after, item, entry);                  TAILQ_INSERT_AFTER(&queue->list, after, item, entry);
                 log_debug("%s %s: %s after %s", __func__, cmdq_name(c),                  log_debug("%s %s: %s after %s", __func__, cmdq_name(c),
                     item->name, after->name);                      item->name, after->name);
   
Line 399 
Line 405 
                 cmd_list_free(item->cmdlist);                  cmd_list_free(item->cmdlist);
         cmdq_free_state(item->state);          cmdq_free_state(item->state);
   
         TAILQ_REMOVE(item->queue, item, entry);          TAILQ_REMOVE(&item->queue->list, item, entry);
   
         free(item->name);          free(item->name);
         free(item);          free(item);
Line 621 
Line 627 
         u_int                    items = 0;          u_int                    items = 0;
         static u_int             number;          static u_int             number;
   
         if (TAILQ_EMPTY(queue)) {          if (TAILQ_EMPTY(&queue->list)) {
                 log_debug("%s %s: empty", __func__, name);                  log_debug("%s %s: empty", __func__, name);
                 return (0);                  return (0);
         }          }
         if (TAILQ_FIRST(queue)->flags & CMDQ_WAITING) {          if (TAILQ_FIRST(&queue->list)->flags & CMDQ_WAITING) {
                 log_debug("%s %s: waiting", __func__, name);                  log_debug("%s %s: waiting", __func__, name);
                 return (0);                  return (0);
         }          }
   
         log_debug("%s %s: enter", __func__, name);          log_debug("%s %s: enter", __func__, name);
         for (;;) {          for (;;) {
                 item = TAILQ_FIRST(queue);                  item = queue->item = TAILQ_FIRST(&queue->list);
                 if (item == NULL)                  if (item == NULL)
                         break;                          break;
                 log_debug("%s %s: %s (%d), flags %x", __func__, name,                  log_debug("%s %s: %s (%d), flags %x", __func__, name,
Line 682 
Line 688 
                 }                  }
                 cmdq_remove(item);                  cmdq_remove(item);
         }          }
           queue->item = NULL;
   
         log_debug("%s %s: exit (empty)", __func__, name);          log_debug("%s %s: exit (empty)", __func__, name);
         return (items);          return (items);
Line 689 
Line 696 
 waiting:  waiting:
         log_debug("%s %s: exit (wait)", __func__, name);          log_debug("%s %s: exit (wait)", __func__, name);
         return (items);          return (items);
   }
   
   /* Get running item if any. */
   struct cmdq_item *
   cmdq_running(struct client *c)
   {
           struct cmdq_list        *queue = cmdq_get(c);
   
           return (queue->item);
 }  }
   
 /* Print a guard line. */  /* Print a guard line. */

Legend:
Removed from v.1.89  
changed lines
  Added in v.1.90