1
0
Fork 0

replaced new/delete with stack objects

This commit is contained in:
Jan Steemann 2012-10-16 00:29:00 +02:00
parent 4cf6cc6a33
commit f78dae4634
2 changed files with 10 additions and 12 deletions

View File

@ -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;

View File

@ -809,15 +809,15 @@ static void RunShell (v8::Handle<v8::Context> context) {
v8::Context::Scope contextScope(context);
v8::Local<v8::String> 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<v8::Context> 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<v8::Context> context) {
BaseClient.stopPager();
}
console->close();
delete console;
console.close();
cout << endl;