Cast in 'rl_readline_name'

In Mac OS, 'rl_readline_name' is declared as 'char*', instead of
'const char*', so we cannot assign to it a string literal such as "lua".
This commit is contained in:
Roberto I
2026-10-16 11:16:12 -03:00
parent 15b2a78106
commit 8cb93bada5
2 changed files with 7 additions and 4 deletions
+2 -1
View File
@@ -465,7 +465,8 @@ static int handle_luainit (lua_State *L) {
#include <readline/readline.h>
#include <readline/history.h>
#define lua_initreadline(L) ((void)L, rl_readline_name="lua")
#define lua_initreadline(L) \
((void)L, *cast(const char **, &rl_readline_name)="lua")
#define lua_readline(buff,prompt) ((void)buff, readline(prompt))
#define lua_saveline(line) add_history(line)
#define lua_freeline(line) free(line)