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

Diff for /src/usr.bin/awk/run.c between version 1.83 and 1.84

version 1.83, 2023/11/28 20:54:38 version 1.84, 2024/01/25 16:40:51
Line 796 
Line 796 
   
 Cell *matchop(Node **a, int n)  /* ~ and match() */  Cell *matchop(Node **a, int n)  /* ~ and match() */
 {  {
         Cell *x, *y;          Cell *x, *y, *z;
         char *s, *t;          char *s, *t;
         int i;          int i;
         int cstart, cpatlen, len;          int cstart, cpatlen, len;
Line 818 
Line 818 
                 i = (*mf)(pfa, s);                  i = (*mf)(pfa, s);
                 tempfree(y);                  tempfree(y);
         }          }
         tempfree(x);          z = x;
         if (n == MATCHFCN) {          if (n == MATCHFCN) {
                 int start = patbeg - s + 1; /* origin 1 */                  int start = patbeg - s + 1; /* origin 1 */
                 if (patlen < 0) {                  if (patlen < 0) {
Line 840 
Line 840 
                 x = gettemp();                  x = gettemp();
                 x->tval = NUM;                  x->tval = NUM;
                 x->fval = start;                  x->fval = start;
                 return x;  
         } else if ((n == MATCH && i == 1) || (n == NOTMATCH && i == 0))          } else if ((n == MATCH && i == 1) || (n == NOTMATCH && i == 0))
                 return(True);                  x = True;
         else          else
                 return(False);                  x = False;
   
           tempfree(z);
           return x;
 }  }
   
   
Line 1299 
Line 1301 
   
                                                 if (bs == NULL) { // invalid character                                                  if (bs == NULL) { // invalid character
                                                         // use unicode invalid character, 0xFFFD                                                          // use unicode invalid character, 0xFFFD
                                                         bs = "\357\277\275";                                                          static char invalid_char[] = "\357\277\275";
                                                           bs = invalid_char;
                                                         count = 3;                                                          count = 3;
                                                 }                                                  }
                                                 t = bs;                                                  t = bs;
Line 2567 
Line 2570 
         start = getsval(x);          start = getsval(x);
         while (pmatch(pfa, start)) {          while (pmatch(pfa, start)) {
                 if (buf == NULL) {                  if (buf == NULL) {
                         if ((pb = buf = malloc(bufsz)) == NULL)                          if ((pb = buf = (char *) malloc(bufsz)) == NULL)
                                 FATAL("out of memory in dosub");                                  FATAL("out of memory in dosub");
                         tempstat = pfa->initstat;                          tempstat = pfa->initstat;
                         pfa->initstat = 2;                          pfa->initstat = 2;
Line 2672 
Line 2675 
         int mflag, tempstat, num, whichm;          int mflag, tempstat, num, whichm;
         int bufsz = recsize;          int bufsz = recsize;
   
         if ((buf = malloc(bufsz)) == NULL)          if ((buf = (char *) malloc(bufsz)) == NULL)
                 FATAL("out of memory in gensub");                  FATAL("out of memory in gensub");
         mflag = 0;      /* if mflag == 0, can replace empty string */          mflag = 0;      /* if mflag == 0, can replace empty string */
         num = 0;          num = 0;

Legend:
Removed from v.1.83  
changed lines
  Added in v.1.84