Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b0e51b2

Browse files
committed
Clean up the unsightly mess around the readline header files. We now
always: - #undef HAVE_CONFIG_H (because otherwise chardefs.h tries to include strings.h) - #include readline.h and history.h and we never declare any readline function prototypes ourselves. This makes it compile with readline 4.2, albeit with a few warnings. Some of the remaining warnings are about completion_matches(), which is renamed to rl_completion_matches(). I've tested it with various other versions, from 2.0 up, and they all seem to work (some with warnings) -- but only on Red Hat Linux 6.2. Fixing the warnings for readline 4.2 would break compatibility with 3.0 (and maybe even earlier versions), and readline doesn't seem to have a way to test for its version at compile time, so I'd rather leave the warnings in than break compilation with older versions.
1 parent fc4ee0a commit b0e51b2

1 file changed

Lines changed: 1 addition & 24 deletions

File tree

Modules/readline.c

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,9 @@
1717
#endif
1818

1919
/* GNU readline definitions */
20-
/* If you have string.h, you might need to add yourself to this #if... [cjh] */
21-
#if defined(__BEOS__)
22-
#undef HAVE_CONFIG_H
23-
/* At max warnings, we need protos for everything. [cjh] */
20+
#undef HAVE_CONFIG_H /* Else readline/chardefs.h includes strings.h */
2421
#include <readline/readline.h>
2522
#include <readline/history.h>
26-
#include <unistd.h>
27-
#else
28-
#include <readline/readline.h> /* You may need to add an -I option to Setup */
29-
30-
#ifdef __CYGWIN__
31-
#include <readline/history.h>
32-
#else /* !__CYGWIN__ */
33-
extern int rl_parse_and_bind(char *);
34-
extern int rl_read_init_file(char *);
35-
extern int rl_insert_text(char *);
36-
extern int rl_bind_key(int, Function *);
37-
extern int rl_bind_key_in_map(int, Function *, Keymap);
38-
extern int rl_initialize(void);
39-
extern int add_history(char *);
40-
extern int read_history(char *);
41-
extern int write_history(char *);
42-
extern int history_truncate_file(char *, int);
43-
extern Function *rl_event_hook;
44-
#endif /* !__CYGWIN__ */
45-
#endif
4623

4724
/* Pointers needed from outside (but not declared in a header file). */
4825
extern DL_IMPORT(int) (*PyOS_InputHook)(void);

0 commit comments

Comments
 (0)