X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/14957cd040308e3eeec43d26bae5d76da13fcd85..HEAD:/create_regex_tables?ds=sidebyside diff --git a/create_regex_tables b/create_regex_tables index bd799ba..c6fd6eb 100644 --- a/create_regex_tables +++ b/create_regex_tables @@ -1,4 +1,4 @@ -# Copyright (C) 2010 Apple Inc. All rights reserved. +# Copyright (C) 2010, 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 @@ -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(CharacterClassTable::create(_%sData, true));\n" % (classes["Inverse"])) + function += (" auto characterClass = std::make_unique(_%sData, true);\n" % (classes["Inverse"])) else: - function += (" CharacterClass* characterClass = new CharacterClass(CharacterClassTable::create(_%sData, false));\n" % (name)) + function += (" auto characterClass = std::make_unique(_%sData, false);\n" % (name)) else: - function += (" CharacterClass* characterClass = new CharacterClass(0);\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