From f78dae4634f66bdb39140f03e7f5177be74f69a9 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Tue, 16 Oct 2012 00:29:00 +0200 Subject: [PATCH] replaced new/delete with stack objects --- arangoirb/MRClient/arangoirb.cpp | 10 +++++----- arangosh/V8Client/arangosh.cpp | 12 +++++------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/arangoirb/MRClient/arangoirb.cpp b/arangoirb/MRClient/arangoirb.cpp index c19786a6d5..7fe2ae89eb 100644 --- a/arangoirb/MRClient/arangoirb.cpp +++ b/arangoirb/MRClient/arangoirb.cpp @@ -244,12 +244,12 @@ static void InitMRClientConnection (mrb_state* mrb, MRubyClientConnection* conne //////////////////////////////////////////////////////////////////////////////// static void RunShell (mrb_state* mrb) { - MRLineEditor* console = new MRLineEditor(mrb, ".arango-mrb"); + MRLineEditor* console(mrb, ".arango-mrb"); - console->open(false /*! NoAutoComplete*/); + console.open(false /*! NoAutoComplete*/); while (true) { - char* input = console->prompt("arangoirb> "); + char* input = console.prompt("arangoirb> "); if (input == 0) { break; @@ -260,7 +260,7 @@ static void RunShell (mrb_state* mrb) { continue; } - console->addHistory(input); + console.addHistory(input); struct mrb_parser_state* p = mrb_parse_nstring(mrb, input, strlen(input), NULL); TRI_FreeString(TRI_CORE_MEM_ZONE, input); @@ -291,7 +291,7 @@ static void RunShell (mrb_state* mrb) { } } - console->close(); + console.close(); cout << endl; diff --git a/arangosh/V8Client/arangosh.cpp b/arangosh/V8Client/arangosh.cpp index 2ca1a3fc62..6e8e09fee3 100644 --- a/arangosh/V8Client/arangosh.cpp +++ b/arangosh/V8Client/arangosh.cpp @@ -809,15 +809,15 @@ static void RunShell (v8::Handle context) { v8::Context::Scope contextScope(context); v8::Local name(v8::String::New("(shell)")); - V8LineEditor* console = new V8LineEditor(context, ".arangosh"); + V8LineEditor console(context, ".arangosh"); - console->open(BaseClient.autoComplete()); + console.open(BaseClient.autoComplete()); while (true) { while (! v8::V8::IdleNotification()) { } - char* input = console->prompt("arangosh> "); + char* input = console.prompt("arangosh> "); if (input == 0) { break; @@ -839,7 +839,7 @@ static void RunShell (v8::Handle context) { input = TRI_DuplicateString("help()"); } - console->addHistory(input); + console.addHistory(input); v8::HandleScope scope; v8::TryCatch tryCatch; @@ -856,9 +856,7 @@ static void RunShell (v8::Handle context) { BaseClient.stopPager(); } - console->close(); - - delete console; + console.close(); cout << endl;