[前][次][番号順一覧][スレッド一覧]

ruby-changes:7935

From: kouji <ko1@a...>
Date: Tue, 23 Sep 2008 02:07:42 +0900 (JST)
Subject: [ruby-changes:7935] Ruby:r19456 (trunk): * ext/readline/readline.c (Init_readline): used remove_history to

kouji	2008-09-23 02:07:22 +0900 (Tue, 23 Sep 2008)

  New Revision: 19456

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19456

  Log:
    * ext/readline/readline.c (Init_readline): used remove_history to
      check offset of history if unsupported clear_history.

  Modified files:
    trunk/ChangeLog
    trunk/ext/readline/readline.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 19455)
+++ ChangeLog	(revision 19456)
@@ -1,3 +1,8 @@
+Tue Sep 23 02:05:34 2008  TAKAO Kouji  <kouji@t...>
+
+	* 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  <matz@r...>
 
 	* lib/tempfile.rb (Tempfile#open): should return a value from the
Index: ext/readline/readline.c
===================================================================
--- ext/readline/readline.c	(revision 19455)
+++ ext/readline/readline.c	(revision 19456)
@@ -1272,14 +1272,22 @@
     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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]