make some class members temporaries since they don't need to persist

This commit is contained in:
Axel Kohlmeyer
2021-08-04 17:19:23 -04:00
parent 2e7b3081a1
commit 08a727d510
2 changed files with 10 additions and 17 deletions

View File

@ -47,12 +47,6 @@ enum{NONE,INT,DOUBLE,STRING,PTR};
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
nfunc = 0;
@ -168,11 +162,12 @@ void PythonImpl::command(int narg, char **arg)
// parse optional args, invoke is not allowed in this mode
ninput = noutput = 0;
istr = nullptr;
ostr = nullptr;
format = nullptr;
length_longstr = 0;
int ninput = 0;
int noutput = 0;
char **istr = nullptr;
char *ostr = nullptr;
char *format = nullptr;
int length_longstr = 0;
char *pyfile = nullptr;
char *herestr = nullptr;
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]
int ifunc = create_entry(arg[0]);
int ifunc = create_entry(arg[0],ninput,noutput,length_longstr, istr, ostr, format);
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
// free old vectors if overwriting old pfunc

View File

@ -35,9 +35,6 @@ class PythonImpl : protected Pointers, public PythonInterface {
bool has_minimum_version(int major, int minor);
private:
int ninput, noutput, length_longstr;
char **istr;
char *ostr, *format;
void *pyMain;
struct PyFunc {
@ -57,7 +54,7 @@ class PythonImpl : protected Pointers, public PythonInterface {
PyFunc *pfuncs;
int nfunc;
int create_entry(char *);
int create_entry(char *, int, int, int, char **, char *, char *);
void deallocate(int);
};