Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Unified Diff: src/i18n.cc

Issue 2273953003: Add support for DateTimeFormat.formatToParts (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: update test262.status Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap-symbols.h ('k') | src/js/datetime-format-to-parts.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/i18n.cc
diff --git a/src/i18n.cc b/src/i18n.cc
index 3418ae79f1e095d4db7b606e72c416938cbee74e..58b8a8dc5c7a5d9df902b01201763df958fd5a3c 100644
--- a/src/i18n.cc
+++ b/src/i18n.cc
@@ -5,6 +5,8 @@
#include "src/i18n.h"
+#include <memory>
+
#include "src/api.h"
#include "src/factory.h"
#include "src/isolate.h"
@@ -115,13 +117,11 @@ icu::SimpleDateFormat* CreateICUDateFormat(
icu::SimpleDateFormat* date_format = NULL;
icu::UnicodeString skeleton;
if (ExtractStringSetting(isolate, options, "skeleton", &skeleton)) {
- icu::DateTimePatternGenerator* generator =
- icu::DateTimePatternGenerator::createInstance(icu_locale, status);
+ std::unique_ptr<icu::DateTimePatternGenerator> generator(
+ icu::DateTimePatternGenerator::createInstance(icu_locale, status));
icu::UnicodeString pattern;
- if (U_SUCCESS(status)) {
+ if (U_SUCCESS(status))
pattern = generator->getBestPattern(skeleton, status);
- delete generator;
- }
date_format = new icu::SimpleDateFormat(pattern, icu_locale, status);
if (U_SUCCESS(status)) {
@@ -132,7 +132,7 @@ icu::SimpleDateFormat* CreateICUDateFormat(
if (U_FAILURE(status)) {
delete calendar;
delete date_format;
- date_format = NULL;
+ date_format = nullptr;
}
return date_format;
« no previous file with comments | « src/heap-symbols.h ('k') | src/js/datetime-format-to-parts.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698