(svn r26778) -Codechange: remove pointless rsl macro

This commit is contained in:
rubidium 2014-09-06 19:57:01 +00:00
parent ac7ef48b0d
commit 506de3c53d
5 changed files with 10 additions and 12 deletions

View File

@ -672,7 +672,7 @@ static SQInteger string_find(HSQUIRRELVM v)
SQObject str=stack_get(v,1); \
SQInteger len=_string(str)->_len; \
const SQChar *sThis=_stringval(str); \
SQChar *sNew=(_ss(v)->GetScratchPad(rsl(len))); \
SQChar *sNew=(_ss(v)->GetScratchPad(len)); \
for(SQInteger i=0;i<len;i++) sNew[i]=func(sThis[i]); \
v->Push(SQString::Create(_ss(v),sNew,len)); \
return 1; \

View File

@ -274,7 +274,7 @@ bool WriteObject(HSQUIRRELVM v,SQUserPointer up,SQWRITEFUNC write,SQObjectPtr &o
switch(type(o)){
case OT_STRING:
_CHECK_IO(SafeWrite(v,write,up,&_string(o)->_len,sizeof(SQInteger)));
_CHECK_IO(SafeWrite(v,write,up,_stringval(o),rsl(_string(o)->_len)));
_CHECK_IO(SafeWrite(v,write,up,_stringval(o),_string(o)->_len));
break;
case OT_INTEGER:
_CHECK_IO(SafeWrite(v,write,up,&_integer(o),sizeof(SQInteger)));break;
@ -297,7 +297,7 @@ bool ReadObject(HSQUIRRELVM v,SQUserPointer up,SQREADFUNC read,SQObjectPtr &o)
case OT_STRING:{
SQInteger len;
_CHECK_IO(SafeRead(v,read,up,&len,sizeof(SQInteger)));
_CHECK_IO(SafeRead(v,read,up,_ss(v)->GetScratchPad(rsl(len)),rsl(len)));
_CHECK_IO(SafeRead(v,read,up,_ss(v)->GetScratchPad(len),len));
o=SQString::Create(_ss(v),_ss(v)->GetScratchPad(-1),len);
}
break;

View File

@ -522,13 +522,13 @@ SQString *SQStringTable::Add(const SQChar *news,SQInteger len)
SQHash h = ::_hashstr(news,(size_t)len)&(_numofslots-1);
SQString *s;
for (s = _strings[h]; s; s = s->_next){
if(s->_len == len && (!memcmp(news,s->_val,(size_t)rsl(len))))
if(s->_len == len && (!memcmp(news,s->_val,(size_t)len)))
return s; //found
}
SQString *t=(SQString *)SQ_MALLOC(rsl(len)+sizeof(SQString));
SQString *t=(SQString *)SQ_MALLOC(len+sizeof(SQString));
new (t) SQString;
memcpy(t->_val,news,(size_t)rsl(len));
memcpy(t->_val,news,(size_t)len);
t->_val[len] = '\0';
t->_len = len;
t->_hash = ::_hashstr(news,(size_t)len);
@ -573,7 +573,7 @@ void SQStringTable::Remove(SQString *bs)
_slotused--;
SQInteger slen = s->_len;
s->~SQString();
SQ_FREE(s,sizeof(SQString) + rsl(slen));
SQ_FREE(s,sizeof(SQString) + slen);
return;
}
prev = s;

View File

@ -123,8 +123,6 @@ private:
#define _instance_ddel _table(_sharedstate->_instance_default_delegate)
#define _weakref_ddel _table(_sharedstate->_weakref_default_delegate)
#define rsl(l) (l)
extern SQObjectPtr _null_;
extern SQObjectPtr _true_;
extern SQObjectPtr _false_;

View File

@ -296,9 +296,9 @@ bool SQVM::StringCat(const SQObjectPtr &str,const SQObjectPtr &obj,SQObjectPtr &
ToString(str, a);
ToString(obj, b);
SQInteger l = _string(a)->_len , ol = _string(b)->_len;
SQChar *s = _sp(rsl(l + ol + 1));
memcpy(s, _stringval(a), (size_t)rsl(l));
memcpy(s + l, _stringval(b), (size_t)rsl(ol));
SQChar *s = _sp(l + ol + 1);
memcpy(s, _stringval(a), (size_t)l);
memcpy(s + l, _stringval(b), (size_t)ol);
dest = SQString::Create(_ss(this), _spval, l + ol);
return true;
}