[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.35 and 1.36

version 1.35, 2016/01/19 16:01:30 version 1.36, 2016/04/29 14:05:24
Line 186 
Line 186 
 cmdq_continue_one(struct cmd_q *cmdq)  cmdq_continue_one(struct cmd_q *cmdq)
 {  {
         struct cmd      *cmd = cmdq->cmd;          struct cmd      *cmd = cmdq->cmd;
           const char      *name = cmd->entry->name;
           struct session  *s;
           struct hooks    *hooks;
         enum cmd_retval  retval;          enum cmd_retval  retval;
         char            *tmp;          char            *tmp;
         int              flags = !!(cmd->flags & CMD_CONTROL);          int              flags = !!(cmd->flags & CMD_CONTROL);
Line 197 
Line 200 
         cmdq->time = time(NULL);          cmdq->time = time(NULL);
         cmdq->number++;          cmdq->number++;
   
         cmdq_guard(cmdq, "begin", flags);          if (~cmdq->flags & CMD_Q_REENTRY)
                   cmdq_guard(cmdq, "begin", flags);
   
         if (cmd_prepare_state(cmd, cmdq, NULL) != 0)          if (cmd_prepare_state(cmd, cmdq, cmdq->parent) != 0)
                 goto error;                  goto error;
   
           if (~cmdq->flags & CMD_Q_NOHOOKS) {
                   s = NULL;
                   if (cmdq->state.tflag.s != NULL)
                           s = cmdq->state.tflag.s;
                   else if (cmdq->state.sflag.s != NULL)
                           s = cmdq->state.sflag.s;
                   else if (cmdq->state.c != NULL)
                           s = cmdq->state.c->session;
                   if (s != NULL)
                           hooks = s->hooks;
                   else
                           hooks = global_hooks;
   
                   if (~cmdq->flags & CMD_Q_REENTRY) {
                           cmdq->flags |= CMD_Q_REENTRY;
                           if (hooks_wait(hooks, cmdq, NULL,
                               "before-%s", name) == 0)
                                   return (CMD_RETURN_WAIT);
                           if (cmd_prepare_state(cmd, cmdq, cmdq->parent) != 0)
                                   goto error;
                   }
           } else
                   hooks = NULL;
           cmdq->flags &= ~CMD_Q_REENTRY;
   
         retval = cmd->entry->exec(cmd, cmdq);          retval = cmd->entry->exec(cmd, cmdq);
         if (retval == CMD_RETURN_ERROR)          if (retval == CMD_RETURN_ERROR)
                 goto error;                  goto error;
   
           if (hooks != NULL && hooks_wait(hooks, cmdq, NULL,
               "after-%s", name) == 0)
                   retval = CMD_RETURN_WAIT;
         cmdq_guard(cmdq, "end", flags);          cmdq_guard(cmdq, "end", flags);
   
         return (retval);          return (retval);
   
 error:  error:
         cmdq_guard(cmdq, "error", flags);          cmdq_guard(cmdq, "error", flags);
           cmdq->flags &= ~CMD_Q_REENTRY;
         return (CMD_RETURN_ERROR);          return (CMD_RETURN_ERROR);
 }  }
   
Line 232 
Line 267 
         if (empty)          if (empty)
                 goto empty;                  goto empty;
   
         if (cmdq->item == NULL) {          /*
                 cmdq->item = TAILQ_FIRST(&cmdq->queue);           * If the command isn't in the middle of running hooks (due to
                 cmdq->cmd = TAILQ_FIRST(&cmdq->item->cmdlist->list);           * CMD_RETURN_WAIT), move onto the next command; otherwise, leave the
         } else           * state of the queue as it is.
                 cmdq->cmd = TAILQ_NEXT(cmdq->cmd, qentry);           */
           if (~cmdq->flags & CMD_Q_REENTRY) {
                   if (cmdq->item == NULL) {
                           cmdq->item = TAILQ_FIRST(&cmdq->queue);
                           cmdq->cmd = TAILQ_FIRST(&cmdq->item->cmdlist->list);
                   } else
                           cmdq->cmd = TAILQ_NEXT(cmdq->cmd, qentry);
           }
   
         do {          do {
                 while (cmdq->cmd != NULL) {                  while (cmdq->cmd != NULL) {

Legend:
Removed from v.1.35  
changed lines
  Added in v.1.36