Skip to content

Commit 83099cc

Browse files
author
Winfried Bruns
committed
No new for std::shared_ptr
1 parent 269c176 commit 83099cc

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

NormalizModule.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ NmzAutomorphismsToPython(const AutomorphismGroup< Integer >& grp)
746746

747747
#ifdef ENFNORMALIZ
748748
struct NumberFieldCone {
749-
renf_class* nf;
749+
const renf_class* nf;
750750
Cone< renf_elem_class >* cone;
751751
};
752752
#endif
@@ -795,31 +795,31 @@ static Cone< renf_elem_class >* get_cone_renf(PyObject* cone)
795795
return cone_ptr->cone;
796796
}
797797

798-
static renf_class* get_cone_renf_renf(PyObject* cone)
798+
static const renf_class* get_cone_renf_renf(PyObject* cone)
799799
{
800800
NumberFieldCone* cone_ptr = reinterpret_cast< NumberFieldCone* >(
801801
PyCapsule_GetPointer(cone, cone_name_renf));
802802
return cone_ptr->nf;
803803
}
804804
#endif
805805

806-
static PyObject* pack_cone(Cone< mpz_class >* C, void* dummy = nullptr)
806+
static PyObject* pack_cone(Cone< mpz_class >* C, const void* dummy = nullptr)
807807
{
808808
return PyCapsule_New(reinterpret_cast< void* >(C), cone_name,
809809
&delete_cone_mpz);
810810
}
811811

812-
static PyObject* pack_cone(Cone< long long >* C, void* dummy = nullptr)
812+
static PyObject* pack_cone(Cone< long long >* C, const void* dummy = nullptr)
813813
{
814814
return PyCapsule_New(reinterpret_cast< void* >(C), cone_name_long,
815815
&delete_cone_long);
816816
}
817817

818818
#ifdef ENFNORMALIZ
819-
static PyObject* pack_cone(Cone< renf_elem_class >* C, void* nf)
819+
static PyObject* pack_cone(Cone< renf_elem_class >* C, const void* nf)
820820
{
821821
NumberFieldCone* cone_ptr = new NumberFieldCone();
822-
cone_ptr->nf = reinterpret_cast< renf_class* >(nf);
822+
cone_ptr->nf = reinterpret_cast< const renf_class* >(nf);
823823
cone_ptr->cone = C;
824824
return PyCapsule_New(reinterpret_cast< void* >(cone_ptr), cone_name_renf,
825825
&delete_cone_renf);
@@ -1017,9 +1017,9 @@ static PyObject* _NmzConeIntern_renf(PyObject* kwargs)
10171017
string poly = PyUnicodeToString(PySequence_GetItem(number_field_data, 0));
10181018
string var = PyUnicodeToString(PySequence_GetItem(number_field_data, 1));
10191019
string emb = PyUnicodeToString(PySequence_GetItem(number_field_data, 2));
1020-
std::shared_ptr<const renf_class>* renf = new std::shared_ptr<const renf_class>;
1021-
*renf = renf_class::make(poly, var, emb);
1022-
const renf_class* my_renf = renf->get();
1020+
// std::shared_ptr<const renf_class>* renf = new std::shared_ptr<const renf_class>;
1021+
std::shared_ptr<const renf_class> renf = renf_class::make(poly, var, emb);
1022+
const renf_class* my_renf = renf.get();
10231023

10241024
map< InputType, vector< vector< renf_elem_class > > > input;
10251025

@@ -1056,8 +1056,8 @@ static PyObject* _NmzConeIntern_renf(PyObject* kwargs)
10561056

10571057
Cone< renf_elem_class >* C = new Cone< renf_elem_class >(input);
10581058
C->setRenf(my_renf);
1059-
1060-
PyObject* return_container = pack_cone(C, renf);
1059+
1060+
PyObject* return_container = pack_cone(C, my_renf);
10611061

10621062
return return_container;
10631063
FUNC_END
@@ -1325,7 +1325,7 @@ PyObject* _NmzModify(Cone<Integer>* cone, PyObject* args)
13251325
}
13261326

13271327
#ifdef ENFNORMALIZ
1328-
PyObject* _NmzModify_Renf(Cone<renf_elem_class>* cone, renf_class* nf, PyObject* args)
1328+
PyObject* _NmzModify_Renf(Cone<renf_elem_class>* cone, const renf_class* nf, PyObject* args)
13291329
{
13301330
string property = PyUnicodeToString( PyTuple_GetItem(args, 1) );
13311331
PyObject* matrix_py = PyTuple_GetItem(args,2);
@@ -1364,7 +1364,7 @@ PyObject* _NmzModify_Outer(PyObject* self, PyObject* args)
13641364
#ifdef ENFNORMALIZ
13651365
else if (is_cone_renf(cone)) {
13661366
Cone< renf_elem_class >* cone_ptr = get_cone_renf(cone);
1367-
renf_class* nf = get_cone_renf_renf(cone);
1367+
const renf_class* nf = get_cone_renf_renf(cone);
13681368
return _NmzModify_Renf(cone_ptr, nf, args);
13691369
}
13701370
#endif
@@ -1596,7 +1596,7 @@ second is the projection third is the annihilator.
15961596

15971597
template < typename Integer >
15981598
static PyObject*
1599-
_NmzResultImpl(Cone< Integer >* C, PyObject* prop_obj, void* nf = nullptr)
1599+
_NmzResultImpl(Cone< Integer >* C, PyObject* prop_obj, const void* nf = nullptr)
16001600
{
16011601

16021602
string prop = PyUnicodeToString(prop_obj);
@@ -1845,7 +1845,7 @@ MatrixHandler = NULL;
18451845
Cone< renf_elem_class >* cone_ptr = get_cone_renf(cone);
18461846
result = _NmzResultImpl(
18471847
cone_ptr, prop,
1848-
reinterpret_cast< void* >(get_cone_renf_renf(cone)));
1848+
reinterpret_cast< const void* >(get_cone_renf_renf(cone)));
18491849
}
18501850
#endif
18511851

@@ -2425,7 +2425,7 @@ static PyObject* NmzGetRenfInfo(PyObject* self, PyObject* args)
24252425
);
24262426
return NULL;
24272427
}
2428-
renf_class* renf = get_cone_renf_renf(cone_py);
2428+
const renf_class* renf = get_cone_renf_renf(cone_py);
24292429
std::string minpoly_str;
24302430
minpoly_str = fmpq_poly_get_str_pretty(renf->get_renf()->nf->pol, renf->gen_name().c_str());
24312431
std::string res1 = arb_get_str(renf->get_renf()->emb, 64, 0);

0 commit comments

Comments
 (0)