diff options
Diffstat (limited to 'engines/director/lingo/lingo-codegen.cpp')
-rw-r--r-- | engines/director/lingo/lingo-codegen.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/engines/director/lingo/lingo-codegen.cpp b/engines/director/lingo/lingo-codegen.cpp index 32d0bbbc11..dccb95e0c1 100644 --- a/engines/director/lingo/lingo-codegen.cpp +++ b/engines/director/lingo/lingo-codegen.cpp @@ -170,8 +170,7 @@ Symbol *Lingo::lookupVar(const char *name, bool create, bool putInGlobalList) { return NULL; sym = new Symbol; - sym->name = (char *)calloc(strlen(name) + 1, 1); - Common::strlcpy(sym->name, name, strlen(name) + 1); + sym->name = name; sym->type = VOID; sym->u.i = 0; @@ -198,7 +197,6 @@ void Lingo::cleanLocalVars() { for (SymbolHash::const_iterator h = _localvars->begin(); h != _localvars->end(); ++h) { if (!h->_value->global) { Symbol *sym = h->_value; - free(sym->name); delete sym; } } @@ -218,8 +216,7 @@ void Lingo::define(Common::String &name, int start, int nargs, Common::String *p if (sym == NULL) { // Create variable if it was not defined sym = new Symbol; - sym->name = (char *)calloc(name.size() + 1, 1); - Common::strlcpy(sym->name, name.c_str(), name.size() + 1); + sym->name = name; sym->type = HANDLER; _handlers[ENTITY_INDEX(_eventHandlerTypeIds[name.c_str()], _currentEntityId)] = sym; @@ -388,8 +385,7 @@ void Lingo::codeFactory(Common::String &name) { Symbol *sym = new Symbol; - sym->name = (char *)calloc(name.size() + 1, 1); - Common::strlcpy(sym->name, name.c_str(), name.size()); + sym->name = name; sym->type = BLTIN; sym->nargs = -1; sym->maxArgs = 0; |