From 2eb6ff1111a74b033bd990b0f83630bfbb6a66fc Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Aug 2022 03:45:56 -0400 Subject: [PATCH] allow const char * argument --- src/atom.cpp | 5 ++--- src/atom.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/atom.cpp b/src/atom.cpp index 91b72841f0..8981993ec8 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -1891,11 +1891,10 @@ void Atom::add_molecule(int narg, char **arg) return -1 if does not exist ------------------------------------------------------------------------- */ -int Atom::find_molecule(char *id) +int Atom::find_molecule(const char *id) { if (id == nullptr) return -1; - int imol; - for (imol = 0; imol < nmolecule; imol++) + for (int imol = 0; imol < nmolecule; imol++) if (strcmp(id,molecules[imol]->id) == 0) return imol; return -1; } diff --git a/src/atom.h b/src/atom.h index df43898dbf..b9f8536171 100644 --- a/src/atom.h +++ b/src/atom.h @@ -344,7 +344,7 @@ class Atom : protected Pointers { int shape_consistency(int, double &, double &, double &); void add_molecule(int, char **); - int find_molecule(char *); + int find_molecule(const char *); void add_molecule_atom(class Molecule *, int, int, tagint); void first_reorder();