mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 13:12:46 +00:00 
			
		
		
		
	LibUnicode: Do not compare generated file contents before writing
This is now covered by unicode_data.cmake after the superbuild changes.
This commit is contained in:
		
							parent
							
								
									a466b78bf3
								
							
						
					
					
						commit
						c8dbcdb0bc
					
				
					 2 changed files with 4 additions and 28 deletions
				
			
		|  | @ -125,18 +125,6 @@ static constexpr auto s_desired_fields = Array { | |||
|     "simple_lowercase_mapping"sv, | ||||
| }; | ||||
| 
 | ||||
| static void write_to_file_if_different(Core::File& file, StringView contents) | ||||
| { | ||||
|     auto const current_contents = file.read_all(); | ||||
| 
 | ||||
|     if (StringView { current_contents.bytes() } == contents) | ||||
|         return; | ||||
| 
 | ||||
|     VERIFY(file.seek(0)); | ||||
|     VERIFY(file.truncate(0)); | ||||
|     VERIFY(file.write(contents)); | ||||
| } | ||||
| 
 | ||||
| static Vector<u32> parse_code_point_list(StringView const& list) | ||||
| { | ||||
|     Vector<u32> code_points; | ||||
|  | @ -578,7 +566,7 @@ Optional<Script> script_from_string(StringView const& script); | |||
| } | ||||
| )~~~"); | ||||
| 
 | ||||
|     write_to_file_if_different(file, generator.as_string_view()); | ||||
|     file.write(generator.as_string_view()); | ||||
| } | ||||
| 
 | ||||
| static void generate_unicode_data_implementation(Core::File& file, UnicodeData const& unicode_data) | ||||
|  | @ -861,7 +849,7 @@ Optional<@enum_title@> @enum_snake@_from_string(StringView const& @enum_snake@) | |||
| } | ||||
| )~~~"); | ||||
| 
 | ||||
|     write_to_file_if_different(file, generator.as_string_view()); | ||||
|     file.write(generator.as_string_view()); | ||||
| } | ||||
| 
 | ||||
| static Vector<u32> flatten_code_point_ranges(Vector<CodePointRange> const& code_points) | ||||
|  |  | |||
|  | @ -74,18 +74,6 @@ struct UnicodeLocaleData { | |||
|     size_t max_variant_size { 0 }; | ||||
| }; | ||||
| 
 | ||||
| static void write_to_file_if_different(Core::File& file, StringView contents) | ||||
| { | ||||
|     auto const current_contents = file.read_all(); | ||||
| 
 | ||||
|     if (StringView { current_contents.bytes() } == contents) | ||||
|         return; | ||||
| 
 | ||||
|     VERIFY(file.seek(0)); | ||||
|     VERIFY(file.truncate(0)); | ||||
|     VERIFY(file.write(contents)); | ||||
| } | ||||
| 
 | ||||
| static Optional<CanonicalLanguageID> parse_language(StringView language) | ||||
| { | ||||
|     CanonicalLanguageID language_id {}; | ||||
|  | @ -607,7 +595,7 @@ Optional<String> resolve_most_likely_territory(Unicode::LanguageID const& langua | |||
| } | ||||
| )~~~"); | ||||
| 
 | ||||
|     write_to_file_if_different(file, generator.as_string_view()); | ||||
|     file.write(generator.as_string_view()); | ||||
| } | ||||
| 
 | ||||
| static void generate_unicode_locale_implementation(Core::File& file, UnicodeLocaleData& locale_data) | ||||
|  | @ -1144,7 +1132,7 @@ Optional<String> resolve_most_likely_territory(Unicode::LanguageID const& langua | |||
| } | ||||
| )~~~"); | ||||
| 
 | ||||
|     write_to_file_if_different(file, generator.as_string_view()); | ||||
|     file.write(generator.as_string_view()); | ||||
| } | ||||
| 
 | ||||
| int main(int argc, char** argv) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Timothy Flynn
						Timothy Flynn