1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-12-18 07:16:23 -05:00

Fix warning triggered by enforcing const on function names table.

This commit is contained in:
Renaud 2021-07-19 16:36:14 +08:00
parent 92c9208cd4
commit 00b85fab9f
3 changed files with 5 additions and 6 deletions

6
eval.c
View File

@ -316,12 +316,12 @@ void varinit(void)
* *
* @fname: name of function to evaluate. * @fname: name of function to evaluate.
*/ */
static char *gtfun( char *fname) { static const char *gtfun( char *fname) {
unsigned fnum ; /* index to function to eval */ unsigned fnum ; /* index to function to eval */
char *arg1 ; /* value of first argument */ char *arg1 ; /* value of first argument */
char *arg2 ; /* value of second argument */ char *arg2 ; /* value of second argument */
char *arg3 ; /* last argument */ char *arg3 ; /* last argument */
char *retstr ; /* return value */ const char *retstr ; /* return value */
int low, high ; /* binary search indexes */ int low, high ; /* binary search indexes */
/* look the function up in the function table */ /* look the function up in the function table */
@ -1206,7 +1206,7 @@ int is_it_cmd( char *token) {
* *
* char *token; token to evaluate * char *token; token to evaluate
*/ */
char *getval(char *token) const char *getval(char *token)
{ {
int status; /* error return */ int status; /* error return */
struct buffer *bp; /* temp buffer pointer */ struct buffer *bp; /* temp buffer pointer */

2
eval.h
View File

@ -19,7 +19,7 @@ int is_it_cmd( char *token) ;
void varinit( void) ; void varinit( void) ;
int setvar( int f, int n) ; int setvar( int f, int n) ;
char *getval( char *token) ; const char *getval( char *token) ;
int stol( char *val) ; int stol( char *val) ;
char *mklower( char *str) ; char *mklower( char *str) ;

3
exec.c
View File

@ -348,7 +348,6 @@ boolean gettokval( char *tok, int size) {
char *getnewtokval( void) { char *getnewtokval( void) {
char *tmpbuf ; char *tmpbuf ;
char *tmpval ;
char *valbuf ; char *valbuf ;
/* grab token and advance past */ /* grab token and advance past */
@ -357,7 +356,7 @@ char *getnewtokval( void) {
return NULL ; return NULL ;
/* evaluate it */ /* evaluate it */
tmpval = getval( tmpbuf) ; const char *tmpval = getval( tmpbuf) ;
valbuf = malloc( strlen( tmpval) + 1 ) ; valbuf = malloc( strlen( tmpval) + 1 ) ;
if( valbuf != NULL) if( valbuf != NULL)
strcpy( valbuf, tmpval) ; strcpy( valbuf, tmpval) ;