use more const char pointers

This commit is contained in:
Axel Kohlmeyer
2020-09-13 17:12:11 -04:00
parent a2fc33b419
commit 96a5585d65
4 changed files with 16 additions and 15 deletions

View File

@ -2508,7 +2508,7 @@ length of the data area, and a short description.
Typically the name of the pointer variable returned
* \return pointer to the requested data cast to ``void *`` or NULL */
void *Atom::extract(char *name)
void *Atom::extract(const char *name)
{
// --------------------------------------------------------------------
// 4th customization section: customize by adding new variable name

View File

@ -331,7 +331,7 @@ class Atom : protected Pointers {
virtual void sync_modify(ExecutionSpace, unsigned int, unsigned int) {}
void *extract(char *);
void *extract(const char *);
inline int* get_map_array() {return map_array;};
inline int get_map_size() {return map_tag_max+1;};

View File

@ -69,7 +69,7 @@ using namespace LAMMPS_NS;
#ifdef LAMMPS_EXCEPTIONS
#define BEGIN_CAPTURE \
Error * error = lmp->error; \
Error *error = lmp->error; \
try
#define END_CAPTURE \
@ -807,7 +807,7 @@ recognized, the function returns -1. Please also see :cpp:func:`lammps_extract_
* \param keyword string with the name of the thermo keyword
* \return value of the queried setting or -1 if unknown */
int lammps_extract_setting(void * handle, char *keyword)
int lammps_extract_setting(void *handle, const char *keyword)
{
LAMMPS *lmp = (LAMMPS *) handle;
@ -1073,7 +1073,7 @@ to be either an ``int`` or an ``int64_t``. This is selected at
* \return pointer (cast to ``void *``) to the location of the
requested property. NULL if name is not known. */
void *lammps_extract_global(void *handle, char *name)
void *lammps_extract_global(void *handle, const char *name)
{
LAMMPS *lmp = (LAMMPS *) handle;
@ -1165,7 +1165,7 @@ of the :cpp:func:`Atom::extract() <LAMMPS_NS::Atom::extract>` function.
* \return pointer (cast to ``void *``) to the location of the
* requested data or ``NULL`` if not found. */
void *lammps_extract_atom(void *handle, char *name)
void *lammps_extract_atom(void *handle, const char *name)
{
LAMMPS *lmp = (LAMMPS *) handle;
return lmp->atom->extract(name);
@ -3792,7 +3792,7 @@ Valid categories are: *atom*\ , *integrate*\ , *minimize*\ ,
* \param name name of the style
* \return 1 if included, 0 if not.
*/
int lammps_has_style(void * handle, char * category, char * name) {
int lammps_has_style(void *handle, const char *category, const char *name) {
LAMMPS *lmp = (LAMMPS *) handle;
Info info(lmp);
return info.has_style(category, name) ? 0 : 1;
@ -3813,7 +3813,7 @@ categories.
* \param category category of styles
* \return number of styles in category
*/
int lammps_style_count(void * handle, char * category) {
int lammps_style_count(void *handle, const char *category) {
LAMMPS *lmp = (LAMMPS *) handle;
Info info(lmp);
return info.get_available_styles(category).size();
@ -3839,7 +3839,8 @@ Please see :cpp:func:`lammps_has_style` for a list of valid categories.
* \param buf_size size of the provided string buffer
* \return 1 if successful, otherwise 0
*/
int lammps_style_name(void* handle, char * category, int idx, char * buffer, int buf_size) {
int lammps_style_name(void *handle, const char *category, int idx,
const char *buffer, int buf_size) {
LAMMPS *lmp = (LAMMPS *) handle;
Info info(lmp);
auto styles = info.get_available_styles(category);

View File

@ -108,9 +108,9 @@ void lammps_extract_box(void *handle, double *boxlo, double *boxhi,
void lammps_reset_box(void *handle, double *boxlo, double *boxhi,
double xy, double yz, double xz);
int lammps_extract_setting(void *handle, char *keyword);
void *lammps_extract_global(void *handle, char *name);
void *lammps_extract_atom(void *handle, char *name);
int lammps_extract_setting(void *handle, const char *keyword);
void *lammps_extract_global(void *handle, const char *name);
void *lammps_extract_atom(void *handle, const char *name);
#if !defined(LAMMPS_BIGBIG)
int lammps_create_atoms(void *handle, int n, int *id, int *type,
@ -161,9 +161,9 @@ int lammps_config_has_jpeg_support();
int lammps_config_has_ffmpeg_support();
int lammps_config_has_exceptions();
int lammps_has_style(void *, char *, char *);
int lammps_style_count(void *, char *);
int lammps_style_name(void *, char *, int, char *, int);
int lammps_has_style(void *, const char *, const char *);
int lammps_style_count(void *, const char *);
int lammps_style_name(void *, const char *, int, const char *, int);
/* ----------------------------------------------------------------------
* Library functions for accessing neighbor lists