From 6a5c7615f2a3aa891619052d5dbf4e3fd267479f Mon Sep 17 00:00:00 2001 From: Brett Langdon Date: Mon, 31 Dec 2012 08:43:26 -0500 Subject: [PATCH] renamed do_file_baton and do_file_after for more generic use --- src/luastate.cc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/luastate.cc b/src/luastate.cc index 1424a95..98af77a 100644 --- a/src/luastate.cc +++ b/src/luastate.cc @@ -5,27 +5,27 @@ using namespace v8; uv_async_t async; -struct do_file_baton{ +struct async_baton{ Persistent callback; - char* file_name; + char* name; bool error; char msg[1000]; LuaState* state; }; void do_file(uv_work_t *req){ - do_file_baton* baton = static_cast(req->data); + async_baton* baton = static_cast(req->data); - if(luaL_dofile(baton->state->lua_, baton->file_name)){ + if(luaL_dofile(baton->state->lua_, baton->name)){ baton->error = true; - sprintf(baton->msg, "Exception In File %s Has Failed:\n%s\n", baton->file_name, lua_tostring(baton->state->lua_, -1)); + sprintf(baton->msg, "Exception In File %s Has Failed:\n%s\n", baton->name, lua_tostring(baton->state->lua_, -1)); } } -void do_file_after(uv_work_t *req){ +void async_after(uv_work_t *req){ HandleScope scope; - do_file_baton* baton = (do_file_baton *)req->data; + async_baton* baton = (async_baton *)req->data; Local argv[2]; const int argc = 2; @@ -145,15 +145,15 @@ Handle LuaState::DoFile(const Arguments& args){ } LuaState* obj = ObjectWrap::Unwrap(args.This()); - do_file_baton* baton = new do_file_baton(); - baton->file_name = file_name; + async_baton* baton = new async_baton(); + baton->name = file_name; baton->callback = callback; baton->state = obj; obj->Ref(); uv_work_t *req = new uv_work_t; req->data = baton; - uv_queue_work(uv_default_loop(), req, do_file, do_file_after); + uv_queue_work(uv_default_loop(), req, do_file, async_after); return scope.Close(Undefined()); }