Changeset 1f91b9 in git


Ignore:
Timestamp:
Mar 23, 2021, 1:47:28 PM (3 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'c5facdfddea2addfd91babd8b9019161dea4b695')
Children:
83b708e1e62df44f73360736db039f50d5fb9b14
Parents:
fe19cbb0dced364dd1422423b717f42df4c92424
Message:
rIncRefCnt, rDecRefCnt
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • Singular/dyn_modules/interval/interval.cc

    rfe19cbb r1f91b9  
    1616  lower = n_Init(0, r->cf);
    1717  upper = n_Init(0, r->cf);
    18   R = r;
    19   R->ref++;
     18  R = rIncRefCnt(r);
    2019}
    2120
     
    2524  lower = a;
    2625  upper = n_Copy(a, r->cf);
    27   R = r;
    28   R->ref++;
     26  R = rIncRefCnt(r);
    2927}
    3028
     
    3331  lower = a;
    3432  upper = b;
    35   R = r;
    36   R->ref++;
     33  R = rIncRefCnt(r);
    3734}
    3835
     
    4138  lower = n_Copy(I->lower, I->R->cf);
    4239  upper = n_Copy(I->upper, I->R->cf);
    43   R = I->R;
    44   R->ref++;
     40  R = rIncRefCnt(I->R);
    4541}
    4642
     
    4945  n_Delete(&lower, R->cf);
    5046  n_Delete(&upper, R->cf);
    51   R->ref--;
     47  rDecRefCnt(R);
    5248}
    5349
     
    6864      upper = up;
    6965    }
    70     R->ref--;
    71     r->ref++;
    72     R = r;
     66    rDecRefCnt(R);
     67    R = rIncRefCnt(r);
    7368  }
    7469
     
    9085    }
    9186  }
    92   R->ref++;
     87  rIncRefCnt(R);
    9388}
    9489
    9590box::box(box* B)
    9691{
    97   R = B->R;
     92  R = rIncRefCnt(B->R);
    9893  int i, n = R->N;
    9994  intervals = (interval**) omAlloc0(n * sizeof(interval*));
     
    105100    }
    106101  }
    107   R->ref++;
    108102}
    109103
     
    116110  }
    117111  omFree((void**) intervals);
    118   R->ref--;
     112  rDecRefCnt(R);
    119113}
    120114
  • Singular/dyn_modules/systhreads/lintree.cc

    rfe19cbb r1f91b9  
    902902    rKill((ring) last_ring);
    903903  last_ring = r;
    904   if (r) ((ring) r)->ref++;
     904  if (r) rIncRefCnt((ring) r);
    905905}
    906906
  • Singular/iparith.cc

    rfe19cbb r1f91b9  
    37473747      sprintf(name_buffer, "PYTHON_RING_VAR%d",ending);
    37483748      h=enterid(name_buffer,0,RING_CMD,&IDROOT);
    3749       IDRING(h)=r;
    3750       r->ref++;
     3749      IDRING(h)=rIncRefCnt(r);
    37513750    }
    37523751    rSetHdl(h);
     
    79337932      if (rt==RING_CMD)
    79347933      {
    7935         L->m[i].rtyp=rt;  L->m[i].data=h->Data();
    7936         ((ring)L->m[i].data)->ref++;
     7934        L->m[i].rtyp=rt;
     7935        L->m[i].data=rIncRefCnt(((ring)h->Data()));
    79377936      }
    79387937      else
  • Singular/ipassign.cc

    rfe19cbb r1f91b9  
    471471      {
    472472        old_r=(ring)(res-1)->data;
    473         old_r->ref--;
    474       }
    475       (res-1)->data=currRing;
     473        rDecRefCnt(old_r);
     474      }
     475      (res-1)->data=rIncRefCnt(currRing);
    476476      (res-1)->rtyp=RING_CMD;
    477       currRing->ref++;
    478477    }
    479478  }
     
    12001199    }
    12011200  }
    1202   r->ref++;
     1201  rIncRefCnt(r);
    12031202  jiAssignAttr(res,a);
    12041203  return FALSE;
  • Singular/iplib.cc

    rfe19cbb r1f91b9  
    596596    // need to define a ring-hdl for currRingHdl
    597597    tmp_ring=enterid(" tmpRing",myynest,RING_CMD,&IDROOT,FALSE);
    598     IDRING(tmp_ring)=currRing;
    599     currRing->ref++;
     598    IDRING(tmp_ring)=rIncRefCnt(currRing);
    600599    rSetHdl(tmp_ring);
    601600  }
     
    606605  &&(currRing!=save_ring))
    607606  {
    608     currRing->ref--;
     607    rDecRefCnt(currRing);
    609608    idhdl hh=IDROOT;
    610609    idhdl prev=NULL;
  • Singular/ipshell.cc

    rfe19cbb r1f91b9  
    13641364        && (v->Data()==IDDATA(h)))
    13651365        {
    1366           IDRING(h)->ref++;
     1366          rIncRefCnt(IDRING(h));
    13671367          keepring=TRUE;
    13681368          IDLEV(h)=toLev;
     
    13841384    h=(idhdl)v->data;
    13851385    IDLEV(h)=toLev;
    1386     if (keepring) IDRING(h)->ref--;
     1386    if (keepring) rDecRefCnt(IDRING(h));
    13871387    iiNoKeepRing=FALSE;
    13881388    //Print("export %s\n",IDID(h));
     
    62206220    return;
    62216221  }
    6222   r->ref--;
     6222  rDecRefCnt(r);
    62236223}
    62246224
  • Singular/links/ssiLink.cc

    rfe19cbb r1f91b9  
    7878  if (r==currRing)
    7979  {
    80     r->ref++;
     80    rIncRefCnt(r);
    8181    currRingHdl=rFindHdl(r,currRingHdl);
    8282    return TRUE;
     
    9494      {
    9595        h=enterid(name,0,RING_CMD,&IDROOT,FALSE);
    96         IDRING(h)=r;
    97         r->ref=2; /*d->r and h */
     96        IDRING(h)=rIncRefCnt(r);
     97        r->ref=2;/*ref==2: d->r and h */
    9898        break;
    9999      }
     
    101101      && (rEqual(r,IDRING(h),1)))
    102102      {
    103         IDRING(h)->ref++;
     103        rIncRefCnt(IDRING(h));
    104104        break;
    105105      }
     
    111111  {
    112112    rKill(r);
    113     currRing->ref++;
     113    rIncRefCnt(currRing);
    114114    return TRUE;
    115115  }
     
    131131      {
    132132        h=enterid(name,0,RING_CMD,&IDROOT,FALSE);
    133         IDRING(h)=r;
    134         r->ref=2; /*d->r and h */
     133        IDRING(h)=rIncRefCnt(r);
     134        r->ref=2;/*ref==2: d->r and h */
    135135        break;
    136136      }
     
    318318  if (r!=NULL)
    319319  {
    320     /*d->*/r->ref++;
     320    /*d->*/rIncRefCnt(r);
    321321  }
    322322  ssiWriteRing_R(d,r);
     
    618618    }
    619619    omFreeSize(names,N*sizeof(char*));
    620     r->ref=1;
     620    rIncRefCnt(r);
    621621    return r;
    622622  }
     
    14291429             if (errorreported) return NULL;
    14301430             res->data=(char*)d->r;
    1431              if (d->r!=NULL) d->r->ref++;
     1431             if (d->r!=NULL) rIncRefCnt(d->r);
    14321432             res->rtyp=RING_CMD;
    14331433             if (t==15) // setring
  • Singular/newstruct.cc

    rfe19cbb r1f91b9  
    375375            {
    376376              res->data=(void *)currRing; r=currRing;
    377               if (r!=NULL) r->ref++;
     377              if (r!=NULL) rIncRefCnt(r);
    378378              else WerrorS("ring of this member is not set and no basering found");
    379379            }
     
    391391              if (r!=NULL)
    392392              {
    393                 r->ref--;
     393                rDecRefCnt(r);
    394394                al->m[nm->pos-1].data=NULL;
    395395                al->m[nm->pos-1].rtyp=DEF_CMD;
     
    415415            {
    416416              ring old=(ring)al->m[nm->pos-1].data;
    417               old->ref--;
     417              rDecRefCnt(old);
    418418            }
    419419            al->m[nm->pos-1].data=(void*)currRing;
    420             if (currRing!=NULL) currRing->ref++;
     420            if (currRing!=NULL) rIncRefCnt(currRing);
    421421          }
    422422          Subexpr r=(Subexpr)omAlloc0Bin(sSubexpr_bin);
     
    540540      l->m[nm->pos-1].rtyp=RING_CMD;
    541541      l->m[nm->pos-1].data=currRing; //idrecDataInit may create ringdep obj.
    542       if (currRing!=NULL) currRing->ref++;
     542      if (currRing!=NULL) rIncRefCnt(currRing);
    543543    }
    544544    l->m[nm->pos].data=idrecDataInit(nm->typ);
  • Singular/subexpr.cc

    rfe19cbb r1f91b9  
    484484        if (r!=NULL)
    485485        {
    486           r->ref++;
     486          rIncRefCnt(r);
    487487          //Print("s_internalCopy:+  ring %lx, ref %d\n",r,r->ref);
    488488        }
  • libpolys/polys/ext_fields/algext.cc

    rfe19cbb r1f91b9  
    13231323void naKillChar(coeffs cf)
    13241324{
    1325    if ((--cf->extRing->ref) == 0)
    1326      rDelete(cf->extRing);
     1325  rDecRefCnt(cf->extRing);
     1326  if(cf->extRing->ref<0)
     1327    rDelete(cf->extRing);
    13271328}
    13281329
     
    13871388  assume(getCoeffType(cf) == n_algExt);                     // coeff type;
    13881389
    1389   e->r->ref ++; // increase the ref.counter for the ground poly. ring!
     1390  rIncRefCnt(e->r); // increase the ref.counter for the ground poly. ring!
    13901391  const ring R = e->r; // no copy!
    13911392  cf->extRing  = R;
     
    16361637  assume( cf != NULL );
    16371638
    1638   e->r->ref ++; // increase the ref.counter for the ground poly. ring!
     1639  rIncRefCnt(e->r); // increase the ref.counter for the ground poly. ring!
    16391640  const ring R = e->r; // no copy!
    16401641  cf->extRing  = R;
  • libpolys/polys/ext_fields/transext.cc

    rfe19cbb r1f91b9  
    21582158static void ntKillChar(coeffs cf)
    21592159{
    2160   if ((--cf->extRing->ref) == 0)
     2160  rDecRefCnt(cf->extRing);
     2161  if (cf->extRing->ref < 0)
    21612162    rDelete(cf->extRing);
    21622163}
     
    25582559  assume(R != NULL);
    25592560
    2560   R->ref ++; // increase the ref.counter for the ground poly. ring!
     2561  rIncRefCnt(R); // increase the ref.counter for the ground poly. ring!
    25612562
    25622563  cf->extRing           = R;
  • libpolys/polys/monomials/ring.cc

    rfe19cbb r1f91b9  
    245245
    246246
     247  //Print("ref:%d, C->ref:%d\n",r->ref,C->ref);
    247248  PrintS("// coefficients: ");
    248249  if( nCoeff_is_algExt(C) )
     
    13521353  {
    13531354    sum=r1;
    1354     r1->ref++;
     1355    rIncRefCnt(r1);
    13551356    return 0;
    13561357  }
  • libpolys/polys/monomials/ring.h

    rfe19cbb r1f91b9  
    844844/// undo rPlusVar
    845845ring rMinusVar(const ring r, char *v);
    846 #endif
     846
     847static inline ring rIncRefCnt(ring r) { r->ref++; return r; }
     848static inline void rDecRefCnt(ring r) { r->ref--; }
     849#endif
Note: See TracChangeset for help on using the changeset viewer.