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

Diff for /src/usr.bin/tmux/window.c between version 1.21 and 1.22

version 1.21, 2009/08/13 19:04:00 version 1.22, 2009/08/13 20:11:58
Line 122 
Line 122 
 }  }
   
 int  int
 winlink_next_index(struct winlinks *wwl)  winlink_next_index(struct winlinks *wwl, int idx)
 {  {
         u_int   i;          int     i;
   
         for (i = 0; i < INT_MAX; i++) {          i = idx;
           do {
                 if (winlink_find_by_index(wwl, i) == NULL)                  if (winlink_find_by_index(wwl, i) == NULL)
                         return (i);                          return (i);
         }                  if (i == INT_MAX)
                           i = 0;
         fatalx("no free indexes");                  else
                           i++;
           } while (i != idx);
           return (-1);
 }  }
   
 u_int  u_int
Line 152 
Line 156 
 {  {
         struct winlink  *wl;          struct winlink  *wl;
   
         if (idx == -1)          if (idx < 0) {
                 idx = winlink_next_index(wwl);                  if ((idx = winlink_next_index(wwl, -idx - 1)) == -1)
         else if (winlink_find_by_index(wwl, idx) != NULL)                          return (NULL);
           } else if (winlink_find_by_index(wwl, idx) != NULL)
                 return (NULL);                  return (NULL);
   
         if (idx < 0)  
                 fatalx("bad index");  
   
         wl = xcalloc(1, sizeof *wl);          wl = xcalloc(1, sizeof *wl);
         wl->idx = idx;          wl->idx = idx;

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22