[gnu.g++.bug] fix for bug in Regex gsub in libg++ 1.32

jason@MTXINU.COM (Jason Venner) (02/23/89)

*** /viarag/gnu/libg++/src/String.cc	Wed Jan 11 04:17:10 1989
--- String.cc	Wed Feb 22 23:03:59 1989
***************
*** 576,591 ****
    const char* s = rep->s;
  
    StrRep* nrep = Sresize(0, 2 * sl); // guess size
!   char* x = rep->s;
  
    int si = 0;
    int xi = 0;
    int remaining = sl;
!   int  pos, pl;
  
    while (remaining > 0)
    {
!     pos = pat.search(s, sl, pl, si);
      if (pos < 0 || pl <= 0)
        break;
      else
--- 576,591 ----
    const char* s = rep->s;
  
    StrRep* nrep = Sresize(0, 2 * sl); // guess size
!   char* x = nrep->s;
  
    int si = 0;
    int xi = 0;
    int remaining = sl;
!   int  pos, pl = 0;				  // how long is a regular expression?
  
    while (remaining > 0)
    {
!     pos = pat.search(s, sl, pl, si); // unlike string search, the pos returned here is absolute
      if (pos < 0 || pl <= 0)
        break;
      else
***************
*** 596,601 ****
--- 596,602 ----
          nrep = Sresize(nrep, mustfit);
          x = nrep->s;
        }
+ 		pos -= si;
        ncopy(&(s[si]), &(x[xi]), pos);
        ncopy(r, &(x[xi + pos]), rl);
        si += pos + pl;