HTMLEntityTable could use char to reduce binary size
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Sep 2013 20:47:01 +0000 (20:47 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Sep 2013 20:47:01 +0000 (20:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=121176

Reviewed by Anders Carlsson.

Use LChar instead.

* html/parser/HTMLEntityParser.cpp:
(WebCore::HTMLEntityParser::consumeNamedEntity):
* html/parser/HTMLEntityTable.h:
(WebCore::HTMLEntityTableEntry::lastCharacter):
* html/parser/create-html-entity-table:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@155559 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/html/parser/HTMLEntityParser.cpp
Source/WebCore/html/parser/HTMLEntityTable.h
Source/WebCore/html/parser/create-html-entity-table

index dc5a64f23dff21b0186097de848546c63436f8d9..a4fbc1a139067f73adb2bdbb51b2addaf79bd786 100644 (file)
@@ -1,3 +1,18 @@
+2013-09-11  Ryosuke Niwa  <rniwa@webkit.org>
+
+        HTMLEntityTable could use char to reduce binary size
+        https://bugs.webkit.org/show_bug.cgi?id=121176
+
+        Reviewed by Anders Carlsson.
+
+        Use LChar instead.
+
+        * html/parser/HTMLEntityParser.cpp:
+        (WebCore::HTMLEntityParser::consumeNamedEntity):
+        * html/parser/HTMLEntityTable.h:
+        (WebCore::HTMLEntityTableEntry::lastCharacter):
+        * html/parser/create-html-entity-table:
+
 2013-09-11  Brent Fulgham  <bfulgham@apple.com>
 
         [Windows] Revise GDI Create Functions to use GDIObject Smart Pointer.
index 6eefad4b994fa8396a12007cc54e392d34504299..8d2177fd2666b51bb366b1778c04d183f3ae8973 100644 (file)
@@ -100,7 +100,7 @@ public:
             unconsumeCharacters(source, consumedCharacters);
             consumedCharacters.clear();
             const int length = entitySearch.mostRecentMatch()->length;
-            const UChar* reference = entitySearch.mostRecentMatch()->entity;
+            const LChar* reference = entitySearch.mostRecentMatch()->entity;
             for (int i = 0; i < length; ++i) {
                 cc = source.currentChar();
                 ASSERT_UNUSED(reference, cc == *reference++);
index 5293f4612257b0d7ceb612658a57dab3094ddeb2..04fc5d7a548fa01798254fbaacd20755c8cce2f5 100644 (file)
@@ -31,9 +31,9 @@
 namespace WebCore {
 
 struct HTMLEntityTableEntry {
-    UChar lastCharacter() const { return entity[length - 1]; }
+    LChar lastCharacter() const { return entity[length - 1]; }
 
-    const UChar* entity;
+    const LChar* entity;
     int length;
     UChar32 firstValue;
     UChar32 secondValue;
index 28a880e887af9ef2ed70fe5e011cac94b616b3d9..16cb73974b92be686b58447956f29b0f087d09b6 100755 (executable)
@@ -42,10 +42,6 @@ def convert_entity_to_cpp_name(entity):
     return "%s%s" % (entity, postfix)
 
 
-def convert_entity_to_uchar_array(entity):
-    return "{'%s'}" % "', '".join(entity)
-
-
 def convert_value_to_int(value):
     if not value:
         return "0";
@@ -78,6 +74,7 @@ output_file = open(output_path, "w")
 
 output_file.write("""/*
  * Copyright (C) 2010 Google, Inc. All Rights Reserved.
+ * Copyright (C) 2013 Apple Inc. All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -113,9 +110,7 @@ namespace {
 """)
 
 for entry in entries:
-    output_file.write("static const UChar %s[] = %s;\n" % (
-        convert_entity_to_cpp_name(entry[ENTITY]),
-        convert_entity_to_uchar_array(entry[ENTITY])))
+    output_file.write("static const LChar %s[] = \"%s\";\n" % (convert_entity_to_cpp_name(entry[ENTITY]), entry[ENTITY]))
 
 output_file.write("""
 static const HTMLEntityTableEntry staticEntityTable[%s] = {\n""" % entity_count)