Ignore:
Timestamp:
Feb 26, 2018, 12:58:10 PM (6 years ago)
Author:
Karim Abou Zeid <karim23697@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
45fa962b8938643ace5cdc03f189d4457e4c7408
Parents:
1af34f3a9d6f48f7bc59d937c310ee496a6c72585c2b81e417a8c56e4aeebc480d5586e971b5fb5b
Message:
Merge branch 'spielwiese' into develop
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/monomials/p_polys.h

    r1af34f r2b8fab  
    213213// currently only used by Singular/janet
    214214void      p_SimpleContent(poly p, int s, const ring r);
     215number    p_InitContent(poly ph, const ring r);
    215216#endif
    216217
     
    798799static inline poly p_Copy_noCheck(poly p, const ring r)
    799800{
    800   assume(r != NULL); assume(r->p_Procs != NULL); assume(r->p_Procs->p_Copy != NULL);
     801  /*assume(p!=NULL);*/
     802  assume(r != NULL);
     803  assume(r->p_Procs != NULL);
     804  assume(r->p_Procs->p_Copy != NULL);
    801805  return r->p_Procs->p_Copy(p, r);
    802806}
     
    805809static inline poly p_Copy(poly p, const ring r)
    806810{
    807   p_Test(p,r);
    808   const poly pp = p_Copy_noCheck(p, r);
    809   p_Test(pp,r);
    810   return pp;
     811  if (p!=NULL)
     812  {
     813    p_Test(p,r);
     814    const poly pp = p_Copy_noCheck(p, r);
     815    p_Test(pp,r);
     816    return pp;
     817  }
     818  else
     819    return NULL;
    811820}
    812821
     
    824833}
    825834
    826 static inline poly p_LmHead(poly p, const ring r)
    827 {
    828   p_LmCheckPolyRing1(p, r);
    829   poly np;
    830   omTypeAllocBin(poly, np, r->PolyBin);
    831   p_SetRingOfLm(np, r);
    832   memcpy(np->exp, p->exp, r->ExpL_Size*sizeof(long));
    833   pNext(np) = NULL;
    834   pSetCoeff0(np, NULL);
    835   return np;
    836 }
    837 
    838835// returns a copy of p with Lm(p) from lmRing and Tail(p) from tailRing
    839836static inline poly p_Copy(poly p, const ring lmRing, const ring tailRing)
     
    846843#endif
    847844    poly pres = p_Head(p, lmRing);
    848     pNext(pres) = p_Copy_noCheck(pNext(p), tailRing);
     845    if (pNext(p)!=NULL)
     846      pNext(pres) = p_Copy_noCheck(pNext(p), tailRing);
    849847    return pres;
    850848  }
     
    858856  assume( p!= NULL );
    859857  assume( r!= NULL );
    860   r->p_Procs->p_Delete(p, r);
     858  if ((*p)!=NULL) r->p_Procs->p_Delete(p, r);
    861859}
    862860
     
    918916  else if (n_IsZero(n, r->cf))
    919917  {
    920     r->p_Procs->p_Delete(&p, r); // NOTE: without p_Delete - memory leak!
     918    p_Delete(&p, r); // NOTE: without p_Delete - memory leak!
    921919    return NULL;
    922920  }
     
    10531051  if (p == NULL)
    10541052  {
    1055     r->p_Procs->p_Delete(&q, r);
     1053    p_Delete(&q, r);
    10561054    return NULL;
    10571055  }
    10581056  if (q == NULL)
    10591057  {
    1060     r->p_Procs->p_Delete(&p, r);
     1058    p_Delete(&p, r);
    10611059    return NULL;
    10621060  }
     
    10711069      q = r->p_Procs->p_Mult_mm(q, p, r);
    10721070
    1073     r->p_Procs->p_Delete(&p, r);
     1071    p_LmDelete(&p, r);
    10741072    return q;
    10751073  }
     
    10781076  {
    10791077    p = r->p_Procs->p_Mult_mm(p, q, r);
    1080     r->p_Procs->p_Delete(&q, r);
     1078    p_LmDelete(&q, r);
    10811079    return p;
    10821080  }
Note: See TracChangeset for help on using the changeset viewer.