зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1441255, part 2 - Don't make an extra copy of the name string in xptiInterfaceEntry. r=njn
MozReview-Commit-ID: DBOcq2ZNqKu --HG-- extra : rebase_source : d11137e2ec6a429cd9223a722fac36dc9deeac5a
This commit is contained in:
Родитель
2c61ab2952
Коммит
eda8c9ed75
|
@ -20,18 +20,14 @@ xptiInterfaceEntry::Create(const char* aName,
|
|||
XPTInterfaceDescriptor* aDescriptor,
|
||||
xptiTypelibGuts* aTypelib)
|
||||
{
|
||||
int namelen = strlen(aName);
|
||||
void* place =
|
||||
XPT_CALLOC8(gXPTIStructArena, sizeof(xptiInterfaceEntry) + namelen);
|
||||
void* place = XPT_CALLOC8(gXPTIStructArena, sizeof(xptiInterfaceEntry));
|
||||
if (!place) {
|
||||
return nullptr;
|
||||
}
|
||||
return new (place) xptiInterfaceEntry(aName, namelen, aIID, aDescriptor,
|
||||
aTypelib);
|
||||
return new (place) xptiInterfaceEntry(aName, aIID, aDescriptor, aTypelib);
|
||||
}
|
||||
|
||||
xptiInterfaceEntry::xptiInterfaceEntry(const char* aName,
|
||||
size_t aNameLength,
|
||||
const nsID& aIID,
|
||||
XPTInterfaceDescriptor* aDescriptor,
|
||||
xptiTypelibGuts* aTypelib)
|
||||
|
@ -43,8 +39,8 @@ xptiInterfaceEntry::xptiInterfaceEntry(const char* aName,
|
|||
, mMethodBaseIndex(0)
|
||||
, mConstantBaseIndex(0)
|
||||
, mFlags(0)
|
||||
, mName(aName)
|
||||
{
|
||||
memcpy(mName, aName, aNameLength);
|
||||
SetResolvedState(PARTIALLY_RESOLVED);
|
||||
}
|
||||
|
||||
|
|
|
@ -267,7 +267,6 @@ public:
|
|||
|
||||
private:
|
||||
xptiInterfaceEntry(const char* aName,
|
||||
size_t aNameLength,
|
||||
const nsID& aIID,
|
||||
XPTInterfaceDescriptor* aDescriptor,
|
||||
xptiTypelibGuts* aTypelib);
|
||||
|
@ -320,7 +319,7 @@ private:
|
|||
|
||||
xptiInfoFlags mFlags;
|
||||
|
||||
char mName[1]; // Always last. Sized to fit.
|
||||
const char* mName;
|
||||
};
|
||||
|
||||
class xptiInterfaceInfo final : public nsIInterfaceInfo
|
||||
|
|
Загрузка…
Ссылка в новой задаче