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

Diff for /src/usr.bin/mg/line.c between version 1.25 and 1.26

version 1.25, 2005/10/13 20:28:49 version 1.26, 2005/11/18 17:19:51
Line 462 
Line 462 
                 cp1 = &dotp->l_text[doto];                  cp1 = &dotp->l_text[doto];
                 if (kflag == KFORW) {                  if (kflag == KFORW) {
                         while (ksize - kused < chunk)                          while (ksize - kused < chunk)
                                 if (kgrow(FALSE) == FALSE)                                  if (kgrow(kflag) == FALSE)
                                         return (FALSE);                                          return (FALSE);
                         bcopy(cp1, &(kbufp[kused]), (int)chunk);                          bcopy(cp1, &(kbufp[kused]), (int)chunk);
                         kused += chunk;                          kused += chunk;
                 } else if (kflag == KBACK) {                  } else if (kflag == KBACK) {
                         while (kstart < chunk)                          while (kstart < chunk)
                                 if (kgrow(TRUE) == FALSE)                                  if (kgrow(kflag) == FALSE)
                                         return (FALSE);                                          return (FALSE);
                         bcopy(cp1, &(kbufp[kstart - chunk]), (int)chunk);                          bcopy(cp1, &(kbufp[kstart - chunk]), (int)chunk);
                         kstart -= chunk;                          kstart -= chunk;
Line 626 
Line 626 
 int  int
 kinsert(int c, int dir)  kinsert(int c, int dir)
 {  {
         if (kused == ksize && dir == KFORW && kgrow(FALSE) == FALSE)          if (kused == ksize && dir == KFORW && kgrow(dir) == FALSE)
                 return (FALSE);                  return (FALSE);
         if (kstart == 0 && dir == KBACK && kgrow(TRUE) == FALSE)          if (kstart == 0 && dir == KBACK && kgrow(dir) == FALSE)
                 return (FALSE);                  return (FALSE);
         if (dir == KFORW)          if (dir == KFORW)
                 kbufp[kused++] = c;                  kbufp[kused++] = c;
Line 640 
Line 640 
 }  }
   
 /*  /*
  * kgrow - just get more kill buffer for the callee. back is true if   * kgrow - just get more kill buffer for the callee. If dir = KBACK
  * we are trying to get space at the beginning of the kill buffer.   * we are trying to get space at the beginning of the kill buffer.
  */   */
 static int  static int
 kgrow(int back)  kgrow(int dir)
 {  {
         int      nstart;          int      nstart;
         char    *nbufp;          char    *nbufp;
Line 658 
Line 658 
                 ewprintf("Can't get %ld bytes", (long)(ksize + KBLOCK));                  ewprintf("Can't get %ld bytes", (long)(ksize + KBLOCK));
                 return (FALSE);                  return (FALSE);
         }          }
         nstart = (back == TRUE) ? (kstart + KBLOCK) : (KBLOCK / 4);          nstart = (dir == KBACK) ? (kstart + KBLOCK) : (KBLOCK / 4);
         bcopy(&(kbufp[kstart]), &(nbufp[nstart]), (int)(kused - kstart));          bcopy(&(kbufp[kstart]), &(nbufp[nstart]), (int)(kused - kstart));
         if (kbufp != NULL)          if (kbufp != NULL)
                 free((char *)kbufp);                  free((char *)kbufp);

Legend:
Removed from v.1.25  
changed lines
  Added in v.1.26