Changeset d8f7a6 in git


Ignore:
Timestamp:
Aug 23, 2012, 12:23:46 AM (10 years ago)
Author:
Alexander Dreyer <alexander.dreyer@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'ad2543eab51733612ba7d118afc77edca719600e')
Children:
a9bb741e5bd039dd27b862fdf1ca1f5b0f092216
Parents:
babfe48c6b91ec9f26e998cdcf95c8df192b1c05
git-author:
Alexander Dreyer <alexander.dreyer@itwm.fraunhofer.de>2012-08-23 00:23:46+02:00
git-committer:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-09-05 15:52:16+02:00
Message:
fix: handling local idroot
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/countedref.cc

    rbabfe48 rd8f7a6  
    7979    if (myroot == NULL) {
    8080      myroot = enterid(" _shared_data_ ", 0, PACKAGE_CMD, &IDROOT, TRUE);
     81      IDPACKAGE(myroot) = (package)omAlloc0(sizeof(*basePack));
     82      IDPACKAGE(myroot)->idroot = idrec().set(omStrDup("last"), 0, DEF_CMD, FALSE);
     83      IDNEXT(IDPACKAGE(myroot)->idroot) = NULL;
    8184    }
    8285    return &myroot;
     
    8891    sprintf(name, " :%u:%p:_shared_: ", ++counter, data);
    8992
    90     idhdl* root = locals();
    91     short ref = ++(*root)->ref;
    92 
     93    idhdl* root;
     94
     95    if (RingDependend(typ))
     96      root = &currRing->idroot;
     97    else {
     98      root = &IDPACKAGE(*locals())->idroot;
     99      ++(IDPACKAGE(*locals())->ref);
     100    }
    93101    assume((*root)->get(name, 0) == NULL);
    94     (*root) = (*root)->set(name, 0, typ, FALSE);
     102    (*root) = (*root)->set(omStrDup(name), 0, typ, FALSE);
     103
    95104    assume((*root) != NULL);
    96105    IDDATA(*root) = (char*) data;
    97     (*root)->ref = ref;
     106    ++(IDPACKAGE(*locals())->ref);
    98107
    99108    return *root;
     
    101110
    102111  static void erase(idhdl handle) {
    103 
    104     idhdl* root = locals();
    105     short ref = --((*root)->ref);
     112    idhdl* root;
     113    if (RingDependend(IDTYP(handle)))
     114      root = &currRing->idroot;
     115    else {
     116      root = &IDPACKAGE(*locals())->idroot;
     117      (--IDPACKAGE(*locals())->ref);
     118    }
    106119    killhdl2(handle, root, currRing);
    107     (*root)->ref = ref;
    108 
    109     if(ref <= 0) {
     120
     121    if((IDPACKAGE(*locals())->ref) <= 0) {
    110122      killhdl2(*root, &IDROOT, currRing);
    111123      (*root) = NULL;
Note: See TracChangeset for help on using the changeset viewer.