summaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authorkouji <kouji@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-22 17:07:22 +0000
committerkouji <kouji@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-22 17:07:22 +0000
commit9ae831e64ba656be927649be04f0e42b31305cad (patch)
treeb53cb80688a917dbb3ad53fe91309dbe21666330 /ext
parent26b7d5a6b039df520b7f7514d1ddbaeb4b82641d (diff)
downloadruby-9ae831e64ba656be927649be04f0e42b31305cad.tar.gz
ruby-9ae831e64ba656be927649be04f0e42b31305cad.tar.xz
ruby-9ae831e64ba656be927649be04f0e42b31305cad.zip
* ext/readline/readline.c (Init_readline): used remove_history to
check offset of history if unsupported clear_history. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@19456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/readline/readline.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index 1bfec15ea..a8a44783e 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