Chromium Code Reviews| Index: src/d8-readline.cc |
| diff --git a/src/d8-readline.cc b/src/d8-readline.cc |
| index 4cfee8b73aa484c1f3fb9f6654177a45151406be..d43d3ce2499f1263789d93461c3a433777472013 100644 |
| --- a/src/d8-readline.cc |
| +++ b/src/d8-readline.cc |
| @@ -26,6 +26,7 @@ |
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| +#include <cstdio> |
| #include <readline/readline.h> |
| #include <readline/history.h> |
| @@ -33,6 +34,11 @@ |
| #include "d8.h" |
| +#if RL_READLINE_VERSION >= 0x0500 |
|
Erik Corry
2008/12/03 13:43:22
I think this deserves a comment.
|
| +#define completion_matches rl_completion_matches |
| +#endif |
| + |
| + |
| namespace v8 { |
| @@ -85,7 +91,7 @@ void ReadLineEditor::AddHistory(const char* str) { |
| char** ReadLineEditor::AttemptedCompletion(const char* text, |
| int start, |
| int end) { |
| - char** result = rl_completion_matches(text, CompletionGenerator); |
| + char** result = completion_matches(text, CompletionGenerator); |
| rl_attempted_completion_over = true; |
| return result; |
| } |
| @@ -95,7 +101,7 @@ char* ReadLineEditor::CompletionGenerator(const char* text, int state) { |
| static unsigned current_index; |
| static Persistent<Array> current_completions; |
| if (state == 0) { |
| - i::SmartPointer<char> full_text(strndup(rl_line_buffer, rl_point)); |
| + i::SmartPointer<char> full_text(i::OS::StrNDup(rl_line_buffer, rl_point)); |
| HandleScope scope; |
| Handle<Array> completions = |
| Shell::GetCompletions(String::New(text), String::New(*full_text)); |