mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-31 21:51:22 +00:00 
			
		
		
		
	Replace String comparisons with "", String() to is_empty()
Also: - Adds two stress tests to test_string.h - Changes to .empty() on std::strings
This commit is contained in:
		
							parent
							
								
									31ded7e126
								
							
						
					
					
						commit
						49403cbfa0
					
				
					 226 changed files with 1051 additions and 1034 deletions
				
			
		|  | @ -2999,7 +2999,7 @@ bool ShaderLanguage::_validate_function_call(BlockNode *p_block, const FunctionI | |||
| 		} | ||||
| 
 | ||||
| 		FunctionNode *pfunc = shader->functions[i].function; | ||||
| 		if (arg_list == "") { | ||||
| 		if (arg_list.is_empty()) { | ||||
| 			for (int j = 0; j < pfunc->arguments.size(); j++) { | ||||
| 				if (j > 0) { | ||||
| 					arg_list += ", "; | ||||
|  | @ -7236,7 +7236,7 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const FunctionInfo &p_fun | |||
| 			if (tk.type == TK_SEMICOLON) { | ||||
| 				//all is good
 | ||||
| 				if (b->parent_function->return_type != TYPE_VOID) { | ||||
| 					_set_error("Expected return with an expression of type '" + (return_struct_name != "" ? return_struct_name : get_datatype_name(b->parent_function->return_type)) + array_size_string + "'"); | ||||
| 					_set_error("Expected return with an expression of type '" + (!return_struct_name.is_empty() ? return_struct_name : get_datatype_name(b->parent_function->return_type)) + array_size_string + "'"); | ||||
| 					return ERR_PARSE_ERROR; | ||||
| 				} | ||||
| 			} else { | ||||
|  | @ -7248,7 +7248,7 @@ Error ShaderLanguage::_parse_block(BlockNode *p_block, const FunctionInfo &p_fun | |||
| 				} | ||||
| 
 | ||||
| 				if (b->parent_function->return_type != expr->get_datatype() || b->parent_function->return_array_size != expr->get_array_size() || return_struct_name != expr->get_datatype_name()) { | ||||
| 					_set_error("Expected return with an expression of type '" + (return_struct_name != "" ? return_struct_name : get_datatype_name(b->parent_function->return_type)) + array_size_string + "'"); | ||||
| 					_set_error("Expected return with an expression of type '" + (!return_struct_name.is_empty() ? return_struct_name : get_datatype_name(b->parent_function->return_type)) + array_size_string + "'"); | ||||
| 					return ERR_PARSE_ERROR; | ||||
| 				} | ||||
| 
 | ||||
|  | @ -7370,7 +7370,7 @@ String ShaderLanguage::_get_shader_type_list(const Set<String> &p_shader_types) | |||
| 	// Return a list of shader types as an human-readable string
 | ||||
| 	String valid_types; | ||||
| 	for (const Set<String>::Element *E = p_shader_types.front(); E; E = E->next()) { | ||||
| 		if (valid_types != String()) { | ||||
| 		if (!valid_types.is_empty()) { | ||||
| 			valid_types += ", "; | ||||
| 		} | ||||
| 
 | ||||
|  | @ -8933,7 +8933,7 @@ String ShaderLanguage::get_shader_type(const String &p_code) { | |||
| 			break; | ||||
| 
 | ||||
| 		} else if (p_code[i] <= 32) { | ||||
| 			if (cur_identifier != String()) { | ||||
| 			if (!cur_identifier.is_empty()) { | ||||
| 				if (!reading_type) { | ||||
| 					if (cur_identifier != "shader_type") { | ||||
| 						return String(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Nathan Franke
						Nathan Franke