summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/LuaTask.h6
-rw-r--r--lib/LuaTask.cc16
2 files changed, 6 insertions, 16 deletions
diff --git a/include/LuaTask.h b/include/LuaTask.h
index 3695dcb..ae18d40 100644
--- a/include/LuaTask.h
+++ b/include/LuaTask.h
@@ -21,7 +21,7 @@
#define __LUATASK_H__
#include <vector>
-#include <hashtab.h>
+#include <map>
#include <Task.h>
#include <Buffer.h>
@@ -50,12 +50,12 @@ class LuaTask : public Task {
String task;
bool destroy_VM;
- static htab * h;
+ static std::map<Lua *, LuaTask *> h;
};
class LuaTaskMan : public LuaObject {
public:
static void pushstatics(Lua *) throw (GeneralException);
-};
+};
#endif
diff --git a/lib/LuaTask.cc b/lib/LuaTask.cc
index ef1abf7..b475c5b 100644
--- a/lib/LuaTask.cc
+++ b/lib/LuaTask.cc
@@ -30,7 +30,7 @@
#include <CopyJob.h>
#endif
-htab * LuaTask::h = hcreate(1);
+std::map<Lua *, LuaTask *> LuaTask::h;
LuaTask::LuaTask(Lua * __L, const String & _cmd, bool _destroy_VM) : L(__L), cmd(_cmd), nargs(0), c(0), b(0), destroy_VM(_destroy_VM) {
LuaTask * top = gettop();
@@ -62,21 +62,11 @@ LuaTask::~LuaTask() {
}
LuaTask * LuaTask::gettop() {
- if (!hfind(h, (Uint8 *) &L, sizeof(L))) {
- hadd(h, (Uint8 *) &L, sizeof(L), 0);
- }
-
- return (LuaTask *) hstuff(h);
+ return h[L];
}
void LuaTask::settop(LuaTask * v) {
- if (!hfind(h, (Uint8 *) &L, sizeof(L)))
- return;
- if (v) {
- hstuff(h) = v;
- } else {
- hdel(h);
- }
+ h[L] = v;
}
String LuaTask::GetName() {