Use const char pointers when possible in botlib's libvar code

This commit is contained in:
Zack Middleton 2017-06-07 18:54:49 -05:00
parent db1198f6ea
commit d1631d6ea3
4 changed files with 24 additions and 24 deletions

View file

@ -238,7 +238,7 @@ int Export_BotLibShutdown(void)
// Returns: -
// Changes Globals: -
//===========================================================================
int Export_BotLibVarSet(char *var_name, char *value)
int Export_BotLibVarSet(const char *var_name, const char *value)
{
LibVarSet(var_name, value);
return BLERR_NOERROR;
@ -249,7 +249,7 @@ int Export_BotLibVarSet(char *var_name, char *value)
// Returns: -
// Changes Globals: -
//===========================================================================
int Export_BotLibVarGet(char *var_name, char *value, int size)
int Export_BotLibVarGet(const char *var_name, char *value, int size)
{
char *varvalue;

View file

@ -409,9 +409,9 @@ typedef struct botlib_export_s
//shutdown the bot library, returns BLERR_
int (*BotLibShutdown)(void);
//sets a library variable returns BLERR_
int (*BotLibVarSet)(char *var_name, char *value);
int (*BotLibVarSet)(const char *var_name, const char *value);
//gets a library variable returns BLERR_
int (*BotLibVarGet)(char *var_name, char *value, int size);
int (*BotLibVarGet)(const char *var_name, char *value, int size);
//sets a C-like define returns BLERR_
int (*PC_AddGlobalDefine)(char *string);

View file

@ -42,7 +42,7 @@ libvar_t *libvarlist = NULL;
// Returns: -
// Changes Globals: -
//===========================================================================
float LibVarStringValue(char *string)
float LibVarStringValue(const char *string)
{
int dotfound = 0;
float value = 0;
@ -80,7 +80,7 @@ float LibVarStringValue(char *string)
// Returns: -
// Changes Globals: -
//===========================================================================
libvar_t *LibVarAlloc(char *var_name)
libvar_t *LibVarAlloc(const char *var_name)
{
libvar_t *v;
@ -128,7 +128,7 @@ void LibVarDeAllocAll(void)
// Returns: -
// Changes Globals: -
//===========================================================================
libvar_t *LibVarGet(char *var_name)
libvar_t *LibVarGet(const char *var_name)
{
libvar_t *v;
@ -147,7 +147,7 @@ libvar_t *LibVarGet(char *var_name)
// Returns: -
// Changes Globals: -
//===========================================================================
char *LibVarGetString(char *var_name)
char *LibVarGetString(const char *var_name)
{
libvar_t *v;
@ -167,7 +167,7 @@ char *LibVarGetString(char *var_name)
// Returns: -
// Changes Globals: -
//===========================================================================
float LibVarGetValue(char *var_name)
float LibVarGetValue(const char *var_name)
{
libvar_t *v;
@ -187,7 +187,7 @@ float LibVarGetValue(char *var_name)
// Returns: -
// Changes Globals: -
//===========================================================================
libvar_t *LibVar(char *var_name, char *value)
libvar_t *LibVar(const char *var_name, const char *value)
{
libvar_t *v;
v = LibVarGet(var_name);
@ -210,7 +210,7 @@ libvar_t *LibVar(char *var_name, char *value)
// Returns: -
// Changes Globals: -
//===========================================================================
char *LibVarString(char *var_name, char *value)
char *LibVarString(const char *var_name, const char *value)
{
libvar_t *v;
@ -223,7 +223,7 @@ char *LibVarString(char *var_name, char *value)
// Returns: -
// Changes Globals: -
//===========================================================================
float LibVarValue(char *var_name, char *value)
float LibVarValue(const char *var_name, const char *value)
{
libvar_t *v;
@ -236,7 +236,7 @@ float LibVarValue(char *var_name, char *value)
// Returns: -
// Changes Globals: -
//===========================================================================
void LibVarSet(char *var_name, char *value)
void LibVarSet(const char *var_name, const char *value)
{
libvar_t *v;
@ -263,7 +263,7 @@ void LibVarSet(char *var_name, char *value)
// Returns: -
// Changes Globals: -
//===========================================================================
qboolean LibVarChanged(char *var_name)
qboolean LibVarChanged(const char *var_name)
{
libvar_t *v;
@ -283,7 +283,7 @@ qboolean LibVarChanged(char *var_name)
// Returns: -
// Changes Globals: -
//===========================================================================
void LibVarSetNotModified(char *var_name)
void LibVarSetNotModified(const char *var_name)
{
libvar_t *v;

View file

@ -43,21 +43,21 @@ typedef struct libvar_s
//removes all library variables
void LibVarDeAllocAll(void);
//gets the library variable with the given name
libvar_t *LibVarGet(char *var_name);
libvar_t *LibVarGet(const char *var_name);
//gets the string of the library variable with the given name
char *LibVarGetString(char *var_name);
char *LibVarGetString(const char *var_name);
//gets the value of the library variable with the given name
float LibVarGetValue(char *var_name);
float LibVarGetValue(const char *var_name);
//creates the library variable if not existing already and returns it
libvar_t *LibVar(char *var_name, char *value);
libvar_t *LibVar(const char *var_name, const char *value);
//creates the library variable if not existing already and returns the value
float LibVarValue(char *var_name, char *value);
float LibVarValue(const char *var_name, const char *value);
//creates the library variable if not existing already and returns the value string
char *LibVarString(char *var_name, char *value);
char *LibVarString(const char *var_name, const char *value);
//sets the library variable
void LibVarSet(char *var_name, char *value);
void LibVarSet(const char *var_name, const char *value);
//returns true if the library variable has been modified
qboolean LibVarChanged(char *var_name);
qboolean LibVarChanged(const char *var_name);
//sets the library variable to unmodified
void LibVarSetNotModified(char *var_name);
void LibVarSetNotModified(const char *var_name);