Changeset 2b8fab in git for libpolys/polys/monomials/p_polys.h
- Timestamp:
- Feb 26, 2018, 12:58:10 PM (6 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 45fa962b8938643ace5cdc03f189d4457e4c7408
- Parents:
- 1af34f3a9d6f48f7bc59d937c310ee496a6c72585c2b81e417a8c56e4aeebc480d5586e971b5fb5b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/polys/monomials/p_polys.h
r1af34f r2b8fab 213 213 // currently only used by Singular/janet 214 214 void p_SimpleContent(poly p, int s, const ring r); 215 number p_InitContent(poly ph, const ring r); 215 216 #endif 216 217 … … 798 799 static inline poly p_Copy_noCheck(poly p, const ring r) 799 800 { 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); 801 805 return r->p_Procs->p_Copy(p, r); 802 806 } … … 805 809 static inline poly p_Copy(poly p, const ring r) 806 810 { 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; 811 820 } 812 821 … … 824 833 } 825 834 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 838 835 // returns a copy of p with Lm(p) from lmRing and Tail(p) from tailRing 839 836 static inline poly p_Copy(poly p, const ring lmRing, const ring tailRing) … … 846 843 #endif 847 844 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); 849 847 return pres; 850 848 } … … 858 856 assume( p!= NULL ); 859 857 assume( r!= NULL ); 860 r->p_Procs->p_Delete(p, r);858 if ((*p)!=NULL) r->p_Procs->p_Delete(p, r); 861 859 } 862 860 … … 918 916 else if (n_IsZero(n, r->cf)) 919 917 { 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! 921 919 return NULL; 922 920 } … … 1053 1051 if (p == NULL) 1054 1052 { 1055 r->p_Procs->p_Delete(&q, r);1053 p_Delete(&q, r); 1056 1054 return NULL; 1057 1055 } 1058 1056 if (q == NULL) 1059 1057 { 1060 r->p_Procs->p_Delete(&p, r);1058 p_Delete(&p, r); 1061 1059 return NULL; 1062 1060 } … … 1071 1069 q = r->p_Procs->p_Mult_mm(q, p, r); 1072 1070 1073 r->p_Procs->p_Delete(&p, r);1071 p_LmDelete(&p, r); 1074 1072 return q; 1075 1073 } … … 1078 1076 { 1079 1077 p = r->p_Procs->p_Mult_mm(p, q, r); 1080 r->p_Procs->p_Delete(&q, r);1078 p_LmDelete(&q, r); 1081 1079 return p; 1082 1080 }
Note: See TracChangeset
for help on using the changeset viewer.