Skip to content

Commit

Permalink
Fill omitted member initializations
Browse files Browse the repository at this point in the history
* fix minor code defects

Signed-off-by: HyukWoo Park <[email protected]>
  • Loading branch information
clover2123 authored and ksh8281 committed Mar 13, 2023
1 parent 6e3220b commit 8d7e353
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/intl/IntlDateTimeFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ IntlDateTimeFormatObject::IntlDateTimeFormatObject(ExecutionState& state, Object
, m_calendar(String::emptyString)
, m_numberingSystem(String::emptyString)
, m_timeZone(String::emptyString)
, m_icuDateFormat(nullptr)
{
// Let requestedLocales be ? CanonicalizeLocaleList(locales).
ValueVector requestedLocales = Intl::canonicalizeLocaleList(state, locales);
Expand Down
6 changes: 6 additions & 0 deletions src/intl/IntlDisplayNames.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ namespace Escargot {

IntlDisplayNamesObject::IntlDisplayNamesObject(ExecutionState& state, Object* proto, Value locales, Value options)
: DerivedObject(state, proto)
, m_style(nullptr)
, m_type(nullptr)
, m_fallback(nullptr)
, m_locale(nullptr)
, m_languageDisplay(nullptr)
, m_icuLocaleDisplayNames(nullptr)
{
#if defined(ENABLE_RUNTIME_ICU_BINDER)
UVersionInfo versionArray;
Expand Down
4 changes: 4 additions & 0 deletions src/intl/IntlListFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ namespace Escargot {

IntlListFormatObject::IntlListFormatObject(ExecutionState& state, Object* proto, Value locales, Value options)
: DerivedObject(state, proto)
, m_locale(nullptr)
, m_type(nullptr)
, m_style(nullptr)
, m_icuListFormatter(nullptr)
{
// https://tc39.es/ecma402/#sec-Intl.ListFormat
#if defined(ENABLE_RUNTIME_ICU_BINDER)
Expand Down
5 changes: 5 additions & 0 deletions src/intl/IntlLocale.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ IntlLocaleObject::IntlLocaleObject(ExecutionState& state, String* tag, Optional<

IntlLocaleObject::IntlLocaleObject(ExecutionState& state, Object* proto, String* tag, Optional<Object*> options)
: DerivedObject(state, proto)
, m_language(nullptr)
, m_script(nullptr)
, m_region(nullptr)
, m_baseName(nullptr)
, m_locale(nullptr)
{
// Set tag to ? ApplyOptionsToTag(tag, options).
Intl::CanonicalizedLangunageTag buildResult = applyOptionsToTag(state, tag, options);
Expand Down
5 changes: 5 additions & 0 deletions src/intl/IntlPluralRules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ void* IntlPluralRulesObject::operator new(size_t size)

IntlPluralRulesObject::IntlPluralRulesObject(ExecutionState& state, Object* proto, Value locales, Value options)
: DerivedObject(state, proto)
, m_locale(nullptr)
, m_type(nullptr)
, m_minimumIntegerDigits(0)
, m_minimumFractionDigits(0)
, m_maximumFractionDigits(0)
, m_icuPluralRules(nullptr)
, m_icuNumberFormat(nullptr)
{
Expand Down
6 changes: 6 additions & 0 deletions src/intl/IntlRelativeTimeFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ IntlRelativeTimeFormatObject::IntlRelativeTimeFormatObject(ExecutionState& state

IntlRelativeTimeFormatObject::IntlRelativeTimeFormatObject(ExecutionState& state, Object* proto, Value locales, Value optionsInput)
: DerivedObject(state, proto)
, m_locale(nullptr)
, m_dataLocale(nullptr)
, m_numberingSystem(nullptr)
, m_style(nullptr)
, m_numeric(nullptr)
, m_icuRelativeDateTimeFormatter(nullptr)
{
#if defined(ENABLE_RUNTIME_ICU_BINDER)
UVersionInfo versionArray;
Expand Down
9 changes: 5 additions & 4 deletions src/util/Vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -374,16 +374,17 @@ class Vector : public gc {

void shrinkToFit()
{
ASSERT(m_size <= m_capacity);
if (m_size != m_capacity) {
if (m_size) {
ASSERT(!!m_buffer);
T* newBuffer = Allocator().allocate(m_size);
VectorCopier<T>::copy(newBuffer, m_buffer, m_size);

size_t oldC = m_capacity;
m_capacity = m_size;
if (m_buffer)
Allocator().deallocate(m_buffer, oldC);
Allocator().deallocate(m_buffer, m_capacity);

m_buffer = newBuffer;
m_capacity = m_size;
} else {
clear();
}
Expand Down

0 comments on commit 8d7e353

Please sign in to comment.