Changeset - r28336:96eabe406350
[Not reviewed]
master
0 7 0
Rubidium - 11 months ago 2023-12-25 23:31:57
rubidium@openttd.org
Codechange: replace NULL with nullptr
7 files changed with 46 insertions and 46 deletions:
0 comments (0 inline, 0 general)
src/3rdparty/squirrel/sqstdlib/sqstdmath.cpp
Show inline comments
 
@@ -81,13 +81,13 @@ static SQRegFunction mathlib_funcs[] = {
 
	_DECL_FUNC(pow,3,".nn"),
 
	_DECL_FUNC(floor,2,".n"),
 
	_DECL_FUNC(ceil,2,".n"),
 
	_DECL_FUNC(exp,2,".n"),
 
#ifdef EXPORT_DEFAULT_SQUIRREL_FUNCTIONS
 
	_DECL_FUNC(srand,2,".n"),
 
	_DECL_FUNC(rand,1,NULL),
 
	_DECL_FUNC(rand,1,nullptr),
 
#endif /* EXPORT_DEFAULT_SQUIRREL_FUNCTIONS */
 
	_DECL_FUNC(fabs,2,".n"),
 
	_DECL_FUNC(abs,2,".n"),
 
	{nullptr,nullptr,0,nullptr},
 
};
 

	
src/3rdparty/squirrel/sqstdlib/sqstdrex.cpp
Show inline comments
 
@@ -375,14 +375,14 @@ static SQBool sqstd_rex_matchclass(SQRex
 
static const SQChar *sqstd_rex_matchnode(SQRex* exp,SQRexNode *node,const SQChar *str,SQRexNode *next)
 
{
 

	
 
	SQRexNodeType type = node->type;
 
	switch(type) {
 
	case OP_GREEDY: {
 
		//SQRexNode *greedystop = (node->next != -1) ? &exp->_nodes[node->next] : NULL;
 
		SQRexNode *greedystop = NULL;
 
		//SQRexNode *greedystop = (node->next != -1) ? &exp->_nodes[node->next] : nullptr;
 
		SQRexNode *greedystop = nullptr;
 
		SQInteger p0 = (node->right >> 16)&0x0000FFFF, p1 = node->right&0x0000FFFF, nmaches = 0;
 
		const SQChar *s=str, *good = str;
 

	
 
		if(node->next != -1) {
 
			greedystop = &exp->_nodes[node->next];
 
		}
 
@@ -400,13 +400,13 @@ static const SQChar *sqstd_rex_matchnode
 
			if(greedystop) {
 
				//checks that 0 matches satisfy the expression(if so skips)
 
				//if not would always stop(for instance if is a '?')
 
				if(greedystop->type != OP_GREEDY ||
 
				(greedystop->type == OP_GREEDY && ((greedystop->right >> 16)&0x0000FFFF) != 0))
 
				{
 
					SQRexNode *gnext = NULL;
 
					SQRexNode *gnext = nullptr;
 
					if(greedystop->next != -1) {
 
						gnext = &exp->_nodes[greedystop->next];
 
					}else if(next && next->next != -1){
 
						gnext = &exp->_nodes[next->next];
 
					}
 
					stop = sqstd_rex_matchnode(exp,greedystop,s,gnext);
 
@@ -422,32 +422,32 @@ static const SQChar *sqstd_rex_matchnode
 
			if(s >= exp->_eol)
 
				break;
 
		}
 
		if(p0 == p1 && p0 == nmaches) return good;
 
		else if(nmaches >= p0 && p1 == 0xFFFF) return good;
 
		else if(nmaches >= p0 && nmaches <= p1) return good;
 
		return NULL;
 
		return nullptr;
 
	}
 
	case OP_OR: {
 
			const SQChar *asd = str;
 
			SQRexNode *temp=&exp->_nodes[node->left];
 
			while( (asd = sqstd_rex_matchnode(exp,temp,asd,NULL)) ) {
 
			while( (asd = sqstd_rex_matchnode(exp,temp,asd,nullptr)) ) {
 
				if(temp->next != -1)
 
					temp = &exp->_nodes[temp->next];
 
				else
 
					return asd;
 
			}
 
			asd = str;
 
			temp = &exp->_nodes[node->right];
 
			while( (asd = sqstd_rex_matchnode(exp,temp,asd,NULL)) ) {
 
			while( (asd = sqstd_rex_matchnode(exp,temp,asd,nullptr)) ) {
 
				if(temp->next != -1)
 
					temp = &exp->_nodes[temp->next];
 
				else
 
					return asd;
 
			}
 
			return NULL;
 
			return nullptr;
 
			break;
 
	}
 
	case OP_EXPR:
 
	case OP_NOCAPEXPR:{
 
			SQRexNode *n = &exp->_nodes[node->left];
 
			const SQChar *cur = str;
 
@@ -456,75 +456,75 @@ static const SQChar *sqstd_rex_matchnode
 
				capture = exp->_currsubexp;
 
				exp->_matches[capture].begin = cur;
 
				exp->_currsubexp++;
 
			}
 

	
 
			do {
 
				SQRexNode *subnext = NULL;
 
				SQRexNode *subnext = nullptr;
 
				if(n->next != -1) {
 
					subnext = &exp->_nodes[n->next];
 
				}else {
 
					subnext = next;
 
				}
 
				if(!(cur = sqstd_rex_matchnode(exp,n,cur,subnext))) {
 
					if(capture != -1){
 
						exp->_matches[capture].begin = 0;
 
						exp->_matches[capture].len = 0;
 
					}
 
					return NULL;
 
					return nullptr;
 
				}
 
			} while((n->next != -1) && (n = &exp->_nodes[n->next]));
 

	
 
			if(capture != -1)
 
				exp->_matches[capture].len = cur - exp->_matches[capture].begin;
 
			return cur;
 
	}
 
	case OP_WB:
 
		if((str == exp->_bol && !isspace(*str))
 
		 || (str == exp->_eol && !isspace(*(str-1)))
 
		 || (!isspace(*str) && isspace(*(str+1)))
 
		 || (isspace(*str) && !isspace(*(str+1))) ) {
 
			return (node->left == 'b')?str:NULL;
 
			return (node->left == 'b')?str:nullptr;
 
		}
 
		return (node->left == 'b')?NULL:str;
 
		return (node->left == 'b')?nullptr:str;
 
	case OP_BOL:
 
		if(str == exp->_bol) return str;
 
		return NULL;
 
		return nullptr;
 
	case OP_EOL:
 
		if(str == exp->_eol) return str;
 
		return NULL;
 
		return nullptr;
 
	case OP_DOT:{
 
		*str++;
 
				}
 
		return str;
 
	case OP_NCLASS:
 
	case OP_CLASS:
 
		if(sqstd_rex_matchclass(exp,&exp->_nodes[node->left],*str)?(type == OP_CLASS?SQTrue:SQFalse):(type == OP_NCLASS?SQTrue:SQFalse)) {
 
			*str++;
 
			return str;
 
		}
 
		return NULL;
 
		return nullptr;
 
	case OP_CCLASS:
 
		if(sqstd_rex_matchcclass(node->left,*str)) {
 
			*str++;
 
			return str;
 
		}
 
		return NULL;
 
		return nullptr;
 
	default: /* char */
 
		if(*str != (SQChar)node->type) return NULL;
 
		if(*str != (SQChar)node->type) return nullptr;
 
		*str++;
 
		return str;
 
	}
 
	return NULL;
 
	return nullptr;
 
}
 

	
 
/* public api */
 
SQRex *sqstd_rex_compile(const SQChar *pattern,const SQChar **error)
 
{
 
	SQRex *exp = (SQRex *)sq_malloc(sizeof(SQRex));
 
	exp->_eol = exp->_bol = NULL;
 
	exp->_eol = exp->_bol = nullptr;
 
	exp->_p = pattern;
 
	exp->_nallocated = (SQInteger)strlen(pattern) * sizeof(SQChar);
 
	exp->_nodes = (SQRexNode *)sq_malloc(exp->_nallocated * sizeof(SQRexNode));
 
	exp->_nsize = 0;
 
	exp->_matches = 0;
 
	exp->_nsubexpr = 0;
 
@@ -555,13 +555,13 @@ SQRex *sqstd_rex_compile(const SQChar *p
 
#endif
 
		exp->_matches = (SQRexMatch *) sq_malloc(exp->_nsubexpr * sizeof(SQRexMatch));
 
		memset(exp->_matches,0,exp->_nsubexpr * sizeof(SQRexMatch));
 
	}
 
	catch (...) {
 
		sqstd_rex_free(exp);
 
		return NULL;
 
		return nullptr;
 
	}
 
	return exp;
 
}
 

	
 
void sqstd_rex_free(SQRex *exp)
 
{
 
@@ -571,42 +571,42 @@ void sqstd_rex_free(SQRex *exp)
 
		sq_free(exp,sizeof(SQRex));
 
	}
 
}
 

	
 
SQBool sqstd_rex_match(SQRex* exp,const SQChar* text)
 
{
 
	const SQChar* res = NULL;
 
	const SQChar* res = nullptr;
 
	exp->_bol = text;
 
	exp->_eol = text + strlen(text);
 
	exp->_currsubexp = 0;
 
	res = sqstd_rex_matchnode(exp,exp->_nodes,text,NULL);
 
	if(res == NULL || res != exp->_eol)
 
	res = sqstd_rex_matchnode(exp,exp->_nodes,text,nullptr);
 
	if(res == nullptr || res != exp->_eol)
 
		return SQFalse;
 
	return SQTrue;
 
}
 

	
 
SQBool sqstd_rex_searchrange(SQRex* exp,const SQChar* text_begin,const SQChar* text_end,const SQChar** out_begin, const SQChar** out_end)
 
{
 
	const SQChar *cur = NULL;
 
	const SQChar *cur = nullptr;
 
	SQInteger node = exp->_first;
 
	if(text_begin >= text_end) return SQFalse;
 
	exp->_bol = text_begin;
 
	exp->_eol = text_end;
 
	do {
 
		cur = text_begin;
 
		while(node != -1) {
 
			exp->_currsubexp = 0;
 
			cur = sqstd_rex_matchnode(exp,&exp->_nodes[node],cur,NULL);
 
			cur = sqstd_rex_matchnode(exp,&exp->_nodes[node],cur,nullptr);
 
			if(!cur)
 
				break;
 
			node = exp->_nodes[node].next;
 
		}
 
		*text_begin++;
 
	} while(cur == NULL && text_begin != text_end);
 
	} while(cur == nullptr && text_begin != text_end);
 

	
 
	if(cur == NULL)
 
	if(cur == nullptr)
 
		return SQFalse;
 

	
 
	--text_begin;
 

	
 
	if(out_begin) *out_begin = text_begin;
 
	if(out_end) *out_end = cur;
src/3rdparty/squirrel/sqstdlib/sqstdstring.cpp
Show inline comments
 
@@ -109,22 +109,22 @@ static SQInteger _string_split(HSQUIRREL
 
	if(sq_getsize(v,3) == 0) return sq_throwerror(v,"empty separators string");
 
	SQInteger memsize = (sq_getsize(v,2)+1)*sizeof(SQChar);
 
	stemp = sq_getscratchpad(v,memsize);
 
	memcpy(stemp,str,memsize);
 
	tok = scstrtok(stemp,seps);
 
	sq_newarray(v,0);
 
	while( tok != NULL ) {
 
	while( tok != nullptr ) {
 
		sq_pushstring(v,tok,-1);
 
		sq_arrayappend(v,-2);
 
		tok = scstrtok( NULL, seps );
 
		tok = scstrtok( nullptr, seps );
 
	}
 
	return 1;
 
}
 

	
 
#define SETUP_REX(v) \
 
	SQRex *self = NULL; \
 
	SQRex *self = nullptr; \
 
	sq_getinstanceup(v,1,(SQUserPointer *)&self,0);
 

	
 
static SQInteger _rexobj_releasehook(SQUserPointer p, SQInteger size)
 
{
 
	SQRex *self = ((SQRex *)p);
 
	sqstd_rex_free(self);
src/3rdparty/squirrel/squirrel/sqbaselib.cpp
Show inline comments
 
@@ -98,13 +98,13 @@ static SQInteger base_enabledebuginfo(HS
 

	
 
static SQInteger base_getstackinfos(HSQUIRRELVM v)
 
{
 
	SQInteger level;
 
	SQStackInfos si;
 
	SQInteger seq = 0;
 
	const SQChar *name = NULL;
 
	const SQChar *name = nullptr;
 
	sq_getinteger(v, -1, &level);
 
	if (SQ_SUCCEEDED(sq_stackinfos(v, level, &si)))
 
	{
 
		const SQChar *fn = "unknown";
 
		const SQChar *src = "unknown";
 
		if(si.funcname)fn = si.funcname;
 
@@ -177,13 +177,13 @@ static SQInteger base_print(HSQUIRRELVM 
 
}
 

	
 
#ifdef EXPORT_DEFAULT_SQUIRREL_FUNCTIONS
 
static SQInteger base_compilestring(HSQUIRRELVM v)
 
{
 
	SQInteger nargs=sq_gettop(v);
 
	const SQChar *src=NULL,*name="unnamedbuffer";
 
	const SQChar *src=nullptr,*name="unnamedbuffer";
 
	SQInteger size;
 
	sq_getstring(v,2,&src);
 
	size=sq_getsize(v,2);
 
	if(nargs>2){
 
		sq_getstring(v,3,&name);
 
	}
 
@@ -236,32 +236,32 @@ static SQInteger base_type(HSQUIRRELVM v
 
	return 1;
 
}
 

	
 
static SQRegFunction base_funcs[]={
 
	//generic
 
#ifdef EXPORT_DEFAULT_SQUIRREL_FUNCTIONS
 
	{"seterrorhandler",base_seterrorhandler,2, NULL},
 
	{"setdebughook",base_setdebughook,2, NULL},
 
	{"enabledebuginfo",base_enabledebuginfo,2, NULL},
 
	{"seterrorhandler",base_seterrorhandler,2, nullptr},
 
	{"setdebughook",base_setdebughook,2, nullptr},
 
	{"enabledebuginfo",base_enabledebuginfo,2, nullptr},
 
	{"getstackinfos",base_getstackinfos,2, ".n"},
 
	{"getroottable",base_getroottable,1, NULL},
 
	{"setroottable",base_setroottable,2, NULL},
 
	{"getconsttable",base_getconsttable,1, NULL},
 
	{"setconsttable",base_setconsttable,2, NULL},
 
	{"getroottable",base_getroottable,1, nullptr},
 
	{"setroottable",base_setroottable,2, nullptr},
 
	{"getconsttable",base_getconsttable,1, nullptr},
 
	{"setconsttable",base_setconsttable,2, nullptr},
 
#endif
 
	{"assert",base_assert,2, nullptr},
 
	{"print",base_print,2, nullptr},
 
#ifdef EXPORT_DEFAULT_SQUIRREL_FUNCTIONS
 
	{"compilestring",base_compilestring,-2, ".ss"},
 
	{"newthread",base_newthread,2, ".c"},
 
	{"suspend",base_suspend,-1, NULL},
 
	{"suspend",base_suspend,-1, nullptr},
 
#endif
 
	{"array",base_array,-2, ".n"},
 
	{"type",base_type,2, nullptr},
 
#ifdef EXPORT_DEFAULT_SQUIRREL_FUNCTIONS
 
	{"dummy",base_dummy,0,NULL},
 
	{"dummy",base_dummy,0,nullptr},
 
#ifndef NO_GARBAGE_COLLECTOR
 
	{"collectgarbage",base_collectgarbage,1, "t"},
 
#endif
 
#endif
 
	{nullptr,nullptr,0,nullptr}
 
};
src/3rdparty/squirrel/squirrel/sqobject.h
Show inline comments
 
@@ -104,13 +104,13 @@ struct SQObjectPtr;
 

	
 
#define __ObjRelease(obj) { \
 
	if((obj)) {	\
 
		(obj)->_uiRef--; \
 
		if((obj)->_uiRef == 0) \
 
			(obj)->Release(); \
 
		(obj) = NULL;	\
 
		(obj) = nullptr;	\
 
	} \
 
}
 

	
 
#define __ObjAddRef(obj) { \
 
	(obj)->_uiRef++; \
 
}
 
@@ -414,13 +414,13 @@ public:
 
};
 

	
 

	
 
#define ADD_TO_CHAIN(chain,obj) AddToChain(chain,obj)
 
#define REMOVE_FROM_CHAIN(chain,obj) {if(!(_uiRef&MARK_FLAG))RemoveFromChain(chain,obj);}
 
#define CHAINABLE_OBJ SQCollectable
 
#define INIT_CHAIN() {_next=NULL;_prev=NULL;_sharedstate=ss;}
 
#define INIT_CHAIN() {_next=nullptr;_prev=nullptr;_sharedstate=ss;}
 
#else
 

	
 
#define ADD_TO_CHAIN(chain,obj) ((void)0)
 
#define REMOVE_FROM_CHAIN(chain,obj) ((void)0)
 
#define CHAINABLE_OBJ SQRefCounted
 
#define INIT_CHAIN() ((void)0)
src/3rdparty/squirrel/squirrel/sqstate.cpp
Show inline comments
 
@@ -198,13 +198,13 @@ SQSharedState::~SQSharedState()
 
			if(nx) nx->_uiRef++;
 
			if(--t->_uiRef == 0)
 
				t->Release();
 
			t = nx;
 
		}
 
	}
 
//	assert(_gc_chain==NULL); //just to proove a theory
 
//	assert(_gc_chain==nullptr); //just to proove a theory
 
	while(_gc_chain){
 
		_gc_chain->_uiRef--;
 
		_gc_chain->Release();
 
	}
 
#endif
 

	
src/3rdparty/squirrel/squirrel/sqvm.h
Show inline comments
 
@@ -191,13 +191,13 @@ inline SQObjectPtr &stack_get(HSQUIRRELV
 

	
 
#define _ss(_vm_) (_vm_)->_sharedstate
 

	
 
#ifndef NO_GARBAGE_COLLECTOR
 
#define _opt_ss(_vm_) (_vm_)->_sharedstate
 
#else
 
#define _opt_ss(_vm_) NULL
 
#define _opt_ss(_vm_) nullptr
 
#endif
 

	
 
#define PUSH_CALLINFO(v,nci){ \
 
	if(v->_callsstacksize == v->_alloccallsstacksize) { \
 
		if (v->_callsstacksize > 65535 && !v->_in_stackoverflow) {\
 
			v->_in_stackoverflow = true; \
 
@@ -215,9 +215,9 @@ inline SQObjectPtr &stack_get(HSQUIRRELV
 
#define POP_CALLINFO(v){ \
 
	v->_callsstacksize--; \
 
	v->ci->_closure.Null(); \
 
	if(v->_callsstacksize)	\
 
		v->ci = &v->_callsstack[v->_callsstacksize-1] ; \
 
	else	\
 
		v->ci = NULL; \
 
		v->ci = nullptr; \
 
}
 
#endif //_SQVM_H_
0 comments (0 inline, 0 general)