aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Hsieh <andrewhsieh@google.com>2012-12-23 22:40:10 -0800
committerGerrit Code Review <noreply-gerritcodereview@google.com>2012-12-23 22:40:11 -0800
commitf6943b71aea7ae639e41e47feaf5d2d505bee811 (patch)
tree71247c87b4dba2d7e92239c38e77a8bc9f9c003a
parent1a65be974ca1b908969c798923d3a19e7c8ce801 (diff)
parent7eced231853cc34e9f2710a81664dee108176317 (diff)
downloadstlport-f6943b71aea7ae639e41e47feaf5d2d505bee811.tar.gz
Merge "Remove static initializers"
-rw-r--r--src/complex.cpp18
-rw-r--r--src/complex_trig.cpp6
-rw-r--r--src/locale.cpp7
-rw-r--r--src/locale_impl.cpp2
-rw-r--r--src/monetary.cpp4
5 files changed, 22 insertions, 15 deletions
diff --git a/src/complex.cpp b/src/complex.cpp
index 50f310c..6da5bc1 100644
--- a/src/complex.cpp
+++ b/src/complex.cpp
@@ -226,18 +226,24 @@ static complex<_Tp> log10T(const complex<_Tp>& z, const _Tp& ln10_inv) {
return r;
}
-static const float LN10_INVF = 1.f / ::log(10.f);
_STLP_DECLSPEC complex<float> _STLP_CALL log10(const complex<float>& z)
-{ return log10T(z, LN10_INVF); }
+{
+ const float LN10_INVF = 1.f / ::log(10.f);
+ return log10T(z, LN10_INVF);
+}
-static const double LN10_INV = 1. / ::log10(10.);
_STLP_DECLSPEC complex<double> _STLP_CALL log10(const complex<double>& z)
-{ return log10T(z, LN10_INV); }
+{
+ const double LN10_INV = 1. / ::log10(10.);
+ return log10T(z, LN10_INV);
+}
#if !defined (_STLP_NO_LONG_DOUBLE)
-static const long double LN10_INVL = 1.l / ::log(10.l);
_STLP_DECLSPEC complex<long double> _STLP_CALL log10(const complex<long double>& z)
-{ return log10T(z, LN10_INVL); }
+{
+ const long double LN10_INVL = 1.l / ::log(10.l);
+ return log10T(z, LN10_INVL);
+}
#endif
//----------------------------------------------------------------------
diff --git a/src/complex_trig.cpp b/src/complex_trig.cpp
index f566fe9..62d6be7 100644
--- a/src/complex_trig.cpp
+++ b/src/complex_trig.cpp
@@ -42,7 +42,7 @@ _STLP_BEGIN_NAMESPACE
long double ld;
} ldouble_ulimit = {0x408633ce, 0x8fb9f87e, 0xbd23b659, 0x4e9bd8b1};
# if !defined (_STLP_NO_LONG_DOUBLE)
- static const long double ldouble_limit = ldouble_ulimit.ld;
+# define ldouble_limit ldouble_ulimit.ld
# endif
#else
# if defined (M_LN2) && defined (FLT_MAX_EXP)
@@ -54,9 +54,9 @@ _STLP_BEGIN_NAMESPACE
# endif
# if !defined (_STLP_NO_LONG_DOUBLE)
# if defined (M_LN2l)
- static const long double ldouble_limit = M_LN2l * LDBL_MAX_EXP;
+# define ldouble_limit (M_LN2l * LDBL_MAX_EXP)
# else
- static const long double ldouble_limit = ::log(LDBL_MAX);
+# define ldouble_limit ::log(LDBL_MAX)
# endif
# endif
#endif
diff --git a/src/locale.cpp b/src/locale.cpp
index 8df976b..5564a6e 100644
--- a/src/locale.cpp
+++ b/src/locale.cpp
@@ -26,7 +26,8 @@
_STLP_BEGIN_NAMESPACE
-static const string _Nameless("*");
+#define _NAMELESS "*"
+static const char _Nameless[] = _NAMELESS;
static inline bool is_C_locale_name (const char* name)
{ return ((name[0] == 'C') && (name[1] == 0)); }
@@ -248,8 +249,8 @@ locale::locale(const locale& L, const char* name, locale::category c)
if (!name)
_M_throw_on_null_name();
- if (_Nameless == name)
- _STLP_THROW(runtime_error((string("Invalid locale name '") + _Nameless + "'").c_str()));
+ if (!::strcmp(_Nameless, name))
+ _STLP_THROW(runtime_error("Invalid locale name '" _NAMELESS "'"));
_Locale_impl* impl = 0;
diff --git a/src/locale_impl.cpp b/src/locale_impl.cpp
index 103b603..71e0864 100644
--- a/src/locale_impl.cpp
+++ b/src/locale_impl.cpp
@@ -28,7 +28,7 @@
_STLP_BEGIN_NAMESPACE
-static const string _Nameless("*");
+static const char _Nameless[] = "*";
static inline bool is_C_locale_name (const char* name)
{ return ((name[0] == 'C') && (name[1] == 0)); }
diff --git a/src/monetary.cpp b/src/monetary.cpp
index d9b213a..d4a6767 100644
--- a/src/monetary.cpp
+++ b/src/monetary.cpp
@@ -36,9 +36,9 @@ static void _Init_monetary_formats(money_base::pattern& pos_format,
}
// This is being used throughout the library
-static const string _S_empty_string;
+static const char _S_empty_string[] = "";
#ifndef _STLP_NO_WCHAR_T
-static const wstring _S_empty_wstring;
+static const wchar_t _S_empty_wstring[] = L"";
#endif
//