diff options
Diffstat (limited to 'src/3rdparty/squirrel/squirrel/sqstate.cpp')
-rw-r--r-- | src/3rdparty/squirrel/squirrel/sqstate.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/3rdparty/squirrel/squirrel/sqstate.cpp b/src/3rdparty/squirrel/squirrel/sqstate.cpp index 73ee649d5..b7c63746f 100644 --- a/src/3rdparty/squirrel/squirrel/sqstate.cpp +++ b/src/3rdparty/squirrel/squirrel/sqstate.cpp @@ -523,11 +523,7 @@ SQString *SQStringTable::Add(const SQChar *news,SQInteger len) } SQString *t=(SQString *)SQ_MALLOC(len+sizeof(SQString)); - new (t) SQString; - memcpy(t->_val,news,(size_t)len); - t->_val[len] = '\0'; - t->_len = len; - t->_hash = ::_hashstr(news,(size_t)len); + new (t) SQString(news, len); t->_next = _strings[h]; _strings[h] = t; _slotused++; @@ -536,6 +532,15 @@ SQString *SQStringTable::Add(const SQChar *news,SQInteger len) return t; } +SQString::SQString(const SQChar *news, SQInteger len) +{ + memcpy(_val,news,(size_t)len); + _val[len] = '\0'; + _len = len; + _hash = ::_hashstr(news,(size_t)len); + _next = NULL; +} + void SQStringTable::Resize(SQInteger size) { SQInteger oldsize=_numofslots; |