diff options
Diffstat (limited to 'src/3rdparty')
-rw-r--r-- | src/3rdparty/squirrel/squirrel/sqstate.cpp | 15 | ||||
-rw-r--r-- | src/3rdparty/squirrel/squirrel/sqstring.h | 2 |
2 files changed, 11 insertions, 6 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; diff --git a/src/3rdparty/squirrel/squirrel/sqstring.h b/src/3rdparty/squirrel/squirrel/sqstring.h index 14f09e1b0..a5f298e1e 100644 --- a/src/3rdparty/squirrel/squirrel/sqstring.h +++ b/src/3rdparty/squirrel/squirrel/sqstring.h @@ -13,7 +13,7 @@ inline SQHash _hashstr (const SQChar *s, size_t l) struct SQString : public SQRefCounted { - SQString(){} + SQString(const SQChar *news, SQInteger len); ~SQString(){} public: static SQString *Create(SQSharedState *ss, const SQChar *, SQInteger len = -1 ); |