[iortcw] 02/89: All: Use const char pointers when possible in botlib's libvar code

Simon McVittie smcv at debian.org
Fri Sep 8 10:43:55 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to tag 1.51b
in repository iortcw.

commit 23e899e3ba78de71e21f3cc60494b36877a4aeb9
Author: MAN-AT-ARMS <M4N4T4RMS at gmail.com>
Date:   Fri Jun 9 19:48:39 2017 -0400

    All: Use const char pointers when possible in botlib's libvar code
---
 MP/code/botlib/be_interface.c |  4 ++--
 MP/code/botlib/botlib.h       |  4 ++--
 MP/code/botlib/l_libvar.c     | 22 +++++++++++-----------
 MP/code/botlib/l_libvar.h     | 18 +++++++++---------
 SP/code/botlib/be_interface.c |  4 ++--
 SP/code/botlib/botlib.h       |  4 ++--
 SP/code/botlib/l_libvar.c     | 22 +++++++++++-----------
 SP/code/botlib/l_libvar.h     | 18 +++++++++---------
 8 files changed, 48 insertions(+), 48 deletions(-)

diff --git a/MP/code/botlib/be_interface.c b/MP/code/botlib/be_interface.c
index 58f5144..bb2f2ee 100644
--- a/MP/code/botlib/be_interface.c
+++ b/MP/code/botlib/be_interface.c
@@ -269,7 +269,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;
 } //end of the function Export_BotLibVarSet
@@ -279,7 +279,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;
 
 	varvalue = LibVarGetString( var_name );
diff --git a/MP/code/botlib/botlib.h b/MP/code/botlib/botlib.h
index c19d656..d87352d 100644
--- a/MP/code/botlib/botlib.h
+++ b/MP/code/botlib/botlib.h
@@ -440,9 +440,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 );
diff --git a/MP/code/botlib/l_libvar.c b/MP/code/botlib/l_libvar.c
index ea25d5a..6d9d65c 100644
--- a/MP/code/botlib/l_libvar.c
+++ b/MP/code/botlib/l_libvar.c
@@ -48,7 +48,7 @@ libvar_t *libvarlist = NULL;
 // Returns:					-
 // Changes Globals:		-
 //===========================================================================
-float LibVarStringValue( char *string ) {
+float LibVarStringValue( const char *string ) {
 	int dotfound = 0;
 	float value = 0;
 
@@ -82,7 +82,7 @@ float LibVarStringValue( char *string ) {
 // Returns:					-
 // Changes Globals:		-
 //===========================================================================
-libvar_t *LibVarAlloc( char *var_name ) {
+libvar_t *LibVarAlloc( const char *var_name ) {
 	libvar_t *v;
 
 	v = (libvar_t *) GetMemory(sizeof(libvar_t));
@@ -129,7 +129,7 @@ void LibVarDeAllocAll( void ) {
 // Returns:					-
 // Changes Globals:		-
 //===========================================================================
-libvar_t *LibVarGet( char *var_name ) {
+libvar_t *LibVarGet( const char *var_name ) {
 	libvar_t *v;
 
 	for ( v = libvarlist; v; v = v->next )
@@ -146,7 +146,7 @@ libvar_t *LibVarGet( char *var_name ) {
 // Returns:					-
 // Changes Globals:		-
 //===========================================================================
-char *LibVarGetString( char *var_name ) {
+char *LibVarGetString( const char *var_name ) {
 	libvar_t *v;
 
 	v = LibVarGet( var_name );
@@ -164,7 +164,7 @@ char *LibVarGetString( char *var_name ) {
 // Returns:					-
 // Changes Globals:		-
 //===========================================================================
-float LibVarGetValue( char *var_name ) {
+float LibVarGetValue( const char *var_name ) {
 	libvar_t *v;
 
 	v = LibVarGet( var_name );
@@ -182,7 +182,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 );
 	if ( v ) {
@@ -206,7 +206,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;
 
 	v = LibVar( var_name, value );
@@ -218,7 +218,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;
 
 	v = LibVar( var_name, value );
@@ -230,7 +230,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;
 
 	v = LibVarGet( var_name );
@@ -255,7 +255,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;
 
 	v = LibVarGet( var_name );
@@ -273,7 +273,7 @@ qboolean LibVarChanged( char *var_name ) {
 // Returns:					-
 // Changes Globals:		-
 //===========================================================================
-void LibVarSetNotModified( char *var_name ) {
+void LibVarSetNotModified( const char *var_name ) {
 	libvar_t *v;
 
 	v = LibVarGet( var_name );
diff --git a/MP/code/botlib/l_libvar.h b/MP/code/botlib/l_libvar.h
index d6a26cb..e1136c1 100644
--- a/MP/code/botlib/l_libvar.h
+++ b/MP/code/botlib/l_libvar.h
@@ -49,21 +49,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 );
 
diff --git a/SP/code/botlib/be_interface.c b/SP/code/botlib/be_interface.c
index e4b95db..03768e1 100644
--- a/SP/code/botlib/be_interface.c
+++ b/SP/code/botlib/be_interface.c
@@ -271,7 +271,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;
 } //end of the function Export_BotLibVarSet
@@ -281,7 +281,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;
 
 	varvalue = LibVarGetString( var_name );
diff --git a/SP/code/botlib/botlib.h b/SP/code/botlib/botlib.h
index ef2dc97..fdbabcf 100644
--- a/SP/code/botlib/botlib.h
+++ b/SP/code/botlib/botlib.h
@@ -440,9 +440,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 );
diff --git a/SP/code/botlib/l_libvar.c b/SP/code/botlib/l_libvar.c
index ab24aa1..b250a48 100644
--- a/SP/code/botlib/l_libvar.c
+++ b/SP/code/botlib/l_libvar.c
@@ -48,7 +48,7 @@ libvar_t *libvarlist = NULL;
 // Returns:					-
 // Changes Globals:		-
 //===========================================================================
-float LibVarStringValue( char *string ) {
+float LibVarStringValue( const char *string ) {
 	int dotfound = 0;
 	float value = 0;
 
@@ -82,7 +82,7 @@ float LibVarStringValue( char *string ) {
 // Returns:					-
 // Changes Globals:		-
 //===========================================================================
-libvar_t *LibVarAlloc( char *var_name ) {
+libvar_t *LibVarAlloc( const char *var_name ) {
 	libvar_t *v;
 
 	v = (libvar_t *) GetMemory(sizeof(libvar_t));
@@ -129,7 +129,7 @@ void LibVarDeAllocAll( void ) {
 // Returns:					-
 // Changes Globals:		-
 //===========================================================================
-libvar_t *LibVarGet( char *var_name ) {
+libvar_t *LibVarGet( const char *var_name ) {
 	libvar_t *v;
 
 	for ( v = libvarlist; v; v = v->next )
@@ -146,7 +146,7 @@ libvar_t *LibVarGet( char *var_name ) {
 // Returns:					-
 // Changes Globals:		-
 //===========================================================================
-char *LibVarGetString( char *var_name ) {
+char *LibVarGetString( const char *var_name ) {
 	libvar_t *v;
 
 	v = LibVarGet( var_name );
@@ -164,7 +164,7 @@ char *LibVarGetString( char *var_name ) {
 // Returns:					-
 // Changes Globals:		-
 //===========================================================================
-float LibVarGetValue( char *var_name ) {
+float LibVarGetValue( const char *var_name ) {
 	libvar_t *v;
 
 	v = LibVarGet( var_name );
@@ -182,7 +182,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 );
 	if ( v ) {
@@ -206,7 +206,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;
 
 	v = LibVar( var_name, value );
@@ -218,7 +218,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;
 
 	v = LibVar( var_name, value );
@@ -230,7 +230,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;
 
 	v = LibVarGet( var_name );
@@ -255,7 +255,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;
 
 	v = LibVarGet( var_name );
@@ -273,7 +273,7 @@ qboolean LibVarChanged( char *var_name ) {
 // Returns:					-
 // Changes Globals:		-
 //===========================================================================
-void LibVarSetNotModified( char *var_name ) {
+void LibVarSetNotModified( const char *var_name ) {
 	libvar_t *v;
 
 	v = LibVarGet( var_name );
diff --git a/SP/code/botlib/l_libvar.h b/SP/code/botlib/l_libvar.h
index cd04894..79cc265 100644
--- a/SP/code/botlib/l_libvar.h
+++ b/SP/code/botlib/l_libvar.h
@@ -49,21 +49,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 );
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git



More information about the Pkg-games-commits mailing list