From 925e6852b298e18afd30ca99b66525f1299d5c7a Mon Sep 17 00:00:00 2001 From: kouji Date: Mon, 22 Sep 2008 17:07:22 +0000 Subject: [PATCH] * ext/readline/readline.c (Init_readline): used remove_history to check offset of history if unsupported clear_history. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ ext/readline/readline.c | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a129059be7..90aff9fd45 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Sep 23 02:05:34 2008 TAKAO Kouji + + * ext/readline/readline.c (Init_readline): used remove_history to + check offset of history if unsupported clear_history. + Mon Sep 22 17:39:25 2008 Yukihiro Matsumoto * lib/tempfile.rb (Tempfile#open): should return a value from the diff --git a/ext/readline/readline.c b/ext/readline/readline.c index 1bfec15eac..a8a44783eb 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -1272,14 +1272,22 @@ Init_readline() history_get_offset_func = history_get_offset_history_base; #if defined HAVE_RL_LIBRARY_VERSION version = rb_str_new2(rl_library_version); -#if defined HAVE_CLEAR_HISTORY +#if defined HAVE_CLEAR_HISTORY || defined HAVE_REMOVE_HISTORY if (strncmp(rl_library_version, EDIT_LINE_LIBRARY_VERSION, strlen(EDIT_LINE_LIBRARY_VERSION)) == 0) { add_history("1"); if (history_get(history_get_offset_func(0)) == NULL) { history_get_offset_func = history_get_offset_0; } +#if !defined HAVE_CLEAR_HISTORY clear_history(); +#else + { + HIST_ENTRY *entry = remove_history(0); + free(entry->line); + free(entry); + } +#endif } #endif #else