From 5762375f09a9a30e2e244c951cc584f37b1614b0 Mon Sep 17 00:00:00 2001 From: darin Date: Sat, 9 Oct 2004 22:17:44 +0000 Subject: [PATCH] Reviewed by Kevin. - fixed REGRESSION: JavaScriptCore framework now has two init routines * bindings/NP_jsobject.cpp: Fixed unnecessarily-complex globals set up that was creating an init routine. * kjs/ustring.cpp: Changed around the UString::Rep::empty construction to not require a global constructor that creates an init routine. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@7798 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- JavaScriptCore/ChangeLog | 12 ++++++++++++ JavaScriptCore/bindings/NP_jsobject.cpp | 3 +-- JavaScriptCore/kjs/ustring.cpp | 6 ++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog index db099d66660f..db26d69e48ca 100644 --- a/JavaScriptCore/ChangeLog +++ b/JavaScriptCore/ChangeLog @@ -1,3 +1,15 @@ +2004-10-09 Darin Adler + + Reviewed by Kevin. + + - fixed REGRESSION: JavaScriptCore framework now has two init routines + + * bindings/NP_jsobject.cpp: Fixed unnecessarily-complex globals set up that was + creating an init routine. + + * kjs/ustring.cpp: Changed around the UString::Rep::empty construction to not + require a global constructor that creates an init routine. + 2004-10-09 Darin Adler Reviewed by Kevin. diff --git a/JavaScriptCore/bindings/NP_jsobject.cpp b/JavaScriptCore/bindings/NP_jsobject.cpp index e1ea07928b44..001cdb8e39d6 100644 --- a/JavaScriptCore/bindings/NP_jsobject.cpp +++ b/JavaScriptCore/bindings/NP_jsobject.cpp @@ -71,8 +71,7 @@ static NPClass _javascriptClass = { 0 }; -static NPClass *javascriptClass = &_javascriptClass; -NPClass *NPScriptObjectClass = javascriptClass; +NPClass *NPScriptObjectClass = &_javascriptClass; Identifier identiferFromNPIdentifier(const NPUTF8 *name) { diff --git a/JavaScriptCore/kjs/ustring.cpp b/JavaScriptCore/kjs/ustring.cpp index 303621b97338..63ad2b20745a 100644 --- a/JavaScriptCore/kjs/ustring.cpp +++ b/JavaScriptCore/kjs/ustring.cpp @@ -142,9 +142,11 @@ bool KJS::operator==(const KJS::CString& c1, const KJS::CString& c2) return len == c2.size() && (len == 0 || memcmp(c1.c_str(), c2.c_str(), len) == 0); } -static UChar dummy; +// Hack here to avoid a global with a constructor; point to an unsigned short instead of a UChar. +static unsigned short almostUChar; +static UChar *const nonNullUCharPointer = reinterpret_cast(&almostUChar); UString::Rep UString::Rep::null = { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 }; -UString::Rep UString::Rep::empty = { 0, 0, 1, 0, 0, 0, &dummy, 0, 0, 0, 0 }; +UString::Rep UString::Rep::empty = { 0, 0, 1, 0, 0, 0, nonNullUCharPointer, 0, 0, 0, 0 }; const int normalStatBufferSize = 4096; static char *statBuffer = 0; static int statBufferSize = 0; -- 2.36.0