Bug 6166 - UString constructors should initialize m_rep
Summary: UString constructors should initialize m_rep
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Enhancement
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-20 09:21 PST by Darin Adler
Modified: 2010-08-11 14:01 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Adler 2005-12-20 09:21:54 PST
The UString constructors currently initialize m_rep to 0 and then assign to it. This results in an extra 
branch. Instead the UString constructors should all initialize m_rep.
Comment 1 Cameron Zwarich (cpst) 2008-09-02 23:46:02 PDT
This seems to be fixed now. Should we close this bug?
Comment 2 Darin Adler 2008-09-03 09:27:11 PDT
No, this is not fixed. Constructors that set m_rep to 0 (by default initializing it, since it's a RefPtr) and then later assign a value to it include:

     UString::UString(const char*)
    UString::UString(const UChar*, int length)
    UString::UString(UChar*, int length, bool copy)
    UString::UString(const Vector<UChar>&)
Comment 3 mitz 2010-08-11 12:54:35 PDT
What about now?
Comment 4 Darin Adler 2010-08-11 14:01:29 PDT
I think it’s fixed now.

I couldn't find the body of UString(const Vector<UChar>&) so I didn't check that one.