make some class members temporaries since they don't need to persist
This commit is contained in:
@ -47,12 +47,6 @@ enum{NONE,INT,DOUBLE,STRING,PTR};
|
|||||||
|
|
||||||
PythonImpl::PythonImpl(LAMMPS *lmp) : Pointers(lmp)
|
PythonImpl::PythonImpl(LAMMPS *lmp) : Pointers(lmp)
|
||||||
{
|
{
|
||||||
ninput = noutput = 0;
|
|
||||||
istr = nullptr;
|
|
||||||
ostr = nullptr;
|
|
||||||
format = nullptr;
|
|
||||||
length_longstr = 0;
|
|
||||||
|
|
||||||
// pfuncs stores interface info for each Python function
|
// pfuncs stores interface info for each Python function
|
||||||
|
|
||||||
nfunc = 0;
|
nfunc = 0;
|
||||||
@ -168,11 +162,12 @@ void PythonImpl::command(int narg, char **arg)
|
|||||||
|
|
||||||
// parse optional args, invoke is not allowed in this mode
|
// parse optional args, invoke is not allowed in this mode
|
||||||
|
|
||||||
ninput = noutput = 0;
|
int ninput = 0;
|
||||||
istr = nullptr;
|
int noutput = 0;
|
||||||
ostr = nullptr;
|
char **istr = nullptr;
|
||||||
format = nullptr;
|
char *ostr = nullptr;
|
||||||
length_longstr = 0;
|
char *format = nullptr;
|
||||||
|
int length_longstr = 0;
|
||||||
char *pyfile = nullptr;
|
char *pyfile = nullptr;
|
||||||
char *herestr = nullptr;
|
char *herestr = nullptr;
|
||||||
int existflag = 0;
|
int existflag = 0;
|
||||||
@ -223,7 +218,7 @@ void PythonImpl::command(int narg, char **arg)
|
|||||||
|
|
||||||
// create or overwrite entry in pfuncs vector with name = arg[0]
|
// create or overwrite entry in pfuncs vector with name = arg[0]
|
||||||
|
|
||||||
int ifunc = create_entry(arg[0]);
|
int ifunc = create_entry(arg[0],ninput,noutput,length_longstr, istr, ostr, format);
|
||||||
|
|
||||||
PyUtils::GIL lock;
|
PyUtils::GIL lock;
|
||||||
|
|
||||||
@ -409,7 +404,8 @@ char *PythonImpl::long_string(int ifunc)
|
|||||||
|
|
||||||
/* ------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------ */
|
||||||
|
|
||||||
int PythonImpl::create_entry(char *name)
|
int PythonImpl::create_entry(char *name, int ninput, int noutput, int length_longstr,
|
||||||
|
char **istr, char *ostr, char *format)
|
||||||
{
|
{
|
||||||
// ifunc = index to entry by name in pfuncs vector, can be old or new
|
// ifunc = index to entry by name in pfuncs vector, can be old or new
|
||||||
// free old vectors if overwriting old pfunc
|
// free old vectors if overwriting old pfunc
|
||||||
|
|||||||
@ -35,9 +35,6 @@ class PythonImpl : protected Pointers, public PythonInterface {
|
|||||||
bool has_minimum_version(int major, int minor);
|
bool has_minimum_version(int major, int minor);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int ninput, noutput, length_longstr;
|
|
||||||
char **istr;
|
|
||||||
char *ostr, *format;
|
|
||||||
void *pyMain;
|
void *pyMain;
|
||||||
|
|
||||||
struct PyFunc {
|
struct PyFunc {
|
||||||
@ -57,7 +54,7 @@ class PythonImpl : protected Pointers, public PythonInterface {
|
|||||||
PyFunc *pfuncs;
|
PyFunc *pfuncs;
|
||||||
int nfunc;
|
int nfunc;
|
||||||
|
|
||||||
int create_entry(char *);
|
int create_entry(char *, int, int, int, char **, char *, char *);
|
||||||
void deallocate(int);
|
void deallocate(int);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user