Changeset - r28336:96eabe406350
[Not reviewed]
master
0 7 0
Rubidium - 4 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
 
@@ -84,7 +84,7 @@ static SQRegFunction mathlib_funcs[] = {
 
	_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"),
src/3rdparty/squirrel/sqstdlib/sqstdrex.cpp
Show inline comments
 
@@ -378,8 +378,8 @@ static const SQChar *sqstd_rex_matchnode
 
	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;
 

	
 
@@ -403,7 +403,7 @@ static const SQChar *sqstd_rex_matchnode
 
				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){
 
@@ -425,12 +425,12 @@ static const SQChar *sqstd_rex_matchnode
 
		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
 
@@ -438,13 +438,13 @@ static const SQChar *sqstd_rex_matchnode
 
			}
 
			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:
 
@@ -459,7 +459,7 @@ static const SQChar *sqstd_rex_matchnode
 
			}
 

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

	
 
@@ -483,15 +483,15 @@ static const SQChar *sqstd_rex_matchnode
 
		 || (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++;
 
				}
 
@@ -502,26 +502,26 @@ static const SQChar *sqstd_rex_matchnode
 
			*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));
 
@@ -558,7 +558,7 @@ SQRex *sqstd_rex_compile(const SQChar *p
 
	}
 
	catch (...) {
 
		sqstd_rex_free(exp);
 
		return NULL;
 
		return nullptr;
 
	}
 
	return exp;
 
}
 
@@ -574,19 +574,19 @@ void sqstd_rex_free(SQRex *exp)
 

	
 
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;
 
@@ -595,15 +595,15 @@ SQBool sqstd_rex_searchrange(SQRex* exp,
 
		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;
src/3rdparty/squirrel/sqstdlib/sqstdstring.cpp
Show inline comments
 
@@ -112,16 +112,16 @@ static SQInteger _string_split(HSQUIRREL
 
	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)
src/3rdparty/squirrel/squirrel/sqbaselib.cpp
Show inline comments
 
@@ -101,7 +101,7 @@ static SQInteger base_getstackinfos(HSQU
 
	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)))
 
	{
 
@@ -180,7 +180,7 @@ static SQInteger base_print(HSQUIRRELVM 
 
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);
 
@@ -239,26 +239,26 @@ static SQInteger base_type(HSQUIRRELVM v
 
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
src/3rdparty/squirrel/squirrel/sqobject.h
Show inline comments
 
@@ -107,7 +107,7 @@ struct SQObjectPtr;
 
		(obj)->_uiRef--; \
 
		if((obj)->_uiRef == 0) \
 
			(obj)->Release(); \
 
		(obj) = NULL;	\
 
		(obj) = nullptr;	\
 
	} \
 
}
 

	
 
@@ -417,7 +417,7 @@ 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)
src/3rdparty/squirrel/squirrel/sqstate.cpp
Show inline comments
 
@@ -201,7 +201,7 @@ SQSharedState::~SQSharedState()
 
			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();
src/3rdparty/squirrel/squirrel/sqvm.h
Show inline comments
 
@@ -194,7 +194,7 @@ inline SQObjectPtr &stack_get(HSQUIRRELV
 
#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){ \
 
@@ -218,6 +218,6 @@ inline SQObjectPtr &stack_get(HSQUIRRELV
 
	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)