X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/2d39b0e377c0896910ee49ae70082ba665faf986..HEAD:/create_regex_tables?ds=inline diff --git a/create_regex_tables b/create_regex_tables index 7544b75..c6fd6eb 100644 --- a/create_regex_tables +++ b/create_regex_tables @@ -86,15 +86,15 @@ for name, classes in types.items(): # Generate createFunction: function = ""; - function += ("CharacterClass* %sCreate()\n" % name) + function += ("std::unique_ptr %sCreate()\n" % name) function += ("{\n") if emitTables and classes["UseTable"]: if "Inverse" in classes: - function += (" CharacterClass* characterClass = new CharacterClass(_%sData, true);\n" % (classes["Inverse"])) + function += (" auto characterClass = std::make_unique(_%sData, true);\n" % (classes["Inverse"])) else: - function += (" CharacterClass* characterClass = new CharacterClass(_%sData, false);\n" % (name)) + function += (" auto characterClass = std::make_unique(_%sData, false);\n" % (name)) else: - function += (" CharacterClass* characterClass = new CharacterClass;\n") + function += (" auto characterClass = std::make_unique();\n") for (min, max) in ranges: if (min == max): if (min > 127): @@ -106,7 +106,7 @@ for name, classes in types.items(): function += (" characterClass->m_rangesUnicode.append(CharacterRange(0x%04x, 0x%04x));\n" % (min, max)) else: function += (" characterClass->m_ranges.append(CharacterRange(0x%02x, 0x%02x));\n" % (min, max)) - function += (" return characterClass;\n") + function += (" return WTF::move(characterClass);\n") function += ("}\n\n") functions += function