Return error messages as 'const char *', not 'char *'.

They're never dynamically allocated, and are almost always string
literals, so const is more appropriate.
This commit is contained in:
Simon Tatham
2017-10-01 13:53:24 +01:00
parent de67801b0f
commit b3243d7504
52 changed files with 266 additions and 231 deletions

6
emcc.c
View File

@ -656,7 +656,7 @@ static void cfg_end(int use_results)
/*
* User hit OK.
*/
char *err = midend_set_config(me, cfg_which, cfg);
const char *err = midend_set_config(me, cfg_which, cfg);
if (err) {
/*
@ -766,7 +766,7 @@ void command(int n)
break;
case 9: /* Solve */
if (thegame.can_solve) {
char *msg = midend_solve(me);
const char *msg = midend_solve(me);
if (msg)
js_error_box(msg);
}
@ -863,7 +863,7 @@ void load_game(const char *buffer, int len)
*/
int main(int argc, char **argv)
{
char *param_err;
const char *param_err;
float *colours;
int i;