Skip to content

Commit 2525dc8

Browse files
committed
Under OS X, history_get from readline returns a const char *, but the local
variable the return value is assigned to is char *. Since the assigned-to variable is never changed, simply make that a const char * and cast all calls to get_history to const char * to silence the compiler warning (found with LLVM).
1 parent 6a74da3 commit 2525dc8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Modules/readline.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,7 +1080,7 @@ call_readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
10801080
/* we have a valid line */
10811081
n = strlen(p);
10821082
if (n > 0) {
1083-
char *line;
1083+
const char *line;
10841084
int length = _py_get_history_length();
10851085
if (length > 0)
10861086
#ifdef __APPLE__
@@ -1089,10 +1089,10 @@ call_readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
10891089
* Libedit's emulation uses 0-based indexes,
10901090
* the real readline uses 1-based indexes.
10911091
*/
1092-
line = history_get(length - 1)->line;
1092+
line = (const char *)history_get(length - 1)->line;
10931093
} else
10941094
#endif /* __APPLE__ */
1095-
line = history_get(length)->line;
1095+
line = (const char *)history_get(length)->line;
10961096
else
10971097
line = "";
10981098
if (strcmp(p, line))

0 commit comments

Comments
 (0)