2014-08-25 23:20:01 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2001-04-06 01:27:53 +00:00
|
|
|
|
2003-06-27 04:12:16 +00:00
|
|
|
#include "xpcom-config.h"
|
2015-05-11 19:35:14 +00:00
|
|
|
#include <new>
|
2001-04-06 01:27:53 +00:00
|
|
|
#include "nscore.h"
|
|
|
|
#include "nsCRT.h"
|
|
|
|
|
|
|
|
#include "nsCommandParams.h"
|
2012-03-12 22:53:18 +00:00
|
|
|
#include "mozilla/HashFunctions.h"
|
2001-04-06 01:27:53 +00:00
|
|
|
|
2012-03-12 22:53:18 +00:00
|
|
|
using namespace mozilla;
|
2001-04-06 01:27:53 +00:00
|
|
|
|
2013-11-19 02:58:27 +00:00
|
|
|
const PLDHashTableOps nsCommandParams::sHashOps = {
|
2014-08-25 23:20:01 +00:00
|
|
|
HashKey, HashMatchEntry, HashMoveEntry, HashClearEntry};
|
2001-04-06 01:27:53 +00:00
|
|
|
|
2014-04-27 07:06:00 +00:00
|
|
|
NS_IMPL_ISUPPORTS(nsCommandParams, nsICommandParams)
|
2001-04-06 01:27:53 +00:00
|
|
|
|
|
|
|
nsCommandParams::nsCommandParams()
|
2015-05-06 01:23:39 +00:00
|
|
|
: mValuesHash(&sHashOps, sizeof(HashEntry), 2) {}
|
2001-04-06 01:27:53 +00:00
|
|
|
|
|
|
|
nsCommandParams::~nsCommandParams() {}
|
|
|
|
|
2014-08-25 23:20:01 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsCommandParams::GetValueType(const char* aName, int16_t* aRetVal) {
|
|
|
|
NS_ENSURE_ARG_POINTER(aRetVal);
|
|
|
|
|
|
|
|
HashEntry* foundEntry = GetNamedEntry(aName);
|
|
|
|
if (foundEntry) {
|
|
|
|
*aRetVal = foundEntry->mEntryType;
|
2001-04-06 01:27:53 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2014-08-25 23:20:01 +00:00
|
|
|
*aRetVal = eNoType;
|
2001-04-06 01:27:53 +00:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2014-08-25 23:20:01 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsCommandParams::GetBooleanValue(const char* aName, bool* aRetVal) {
|
|
|
|
NS_ENSURE_ARG_POINTER(aRetVal);
|
2001-04-06 01:27:53 +00:00
|
|
|
|
2018-07-10 09:48:43 +00:00
|
|
|
ErrorResult error;
|
|
|
|
*aRetVal = GetBool(aName, error);
|
|
|
|
return error.StealNSResult();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool nsCommandParams::GetBool(const char* aName, ErrorResult& aRv) const {
|
|
|
|
MOZ_ASSERT(!aRv.Failed());
|
|
|
|
|
2014-08-25 23:20:01 +00:00
|
|
|
HashEntry* foundEntry = GetNamedEntry(aName);
|
|
|
|
if (foundEntry && foundEntry->mEntryType == eBooleanType) {
|
2018-07-10 09:48:43 +00:00
|
|
|
return foundEntry->mData.mBoolean;
|
2001-04-06 01:27:53 +00:00
|
|
|
}
|
2018-07-10 09:48:43 +00:00
|
|
|
aRv.Throw(NS_ERROR_FAILURE);
|
|
|
|
return false;
|
2001-04-06 01:27:53 +00:00
|
|
|
}
|
|
|
|
|
2014-08-25 23:20:01 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsCommandParams::GetLongValue(const char* aName, int32_t* aRetVal) {
|
|
|
|
NS_ENSURE_ARG_POINTER(aRetVal);
|
2001-04-06 01:27:53 +00:00
|
|
|
|
2018-07-10 09:48:43 +00:00
|
|
|
ErrorResult error;
|
|
|
|
*aRetVal = GetInt(aName, error);
|
|
|
|
return error.StealNSResult();
|
|
|
|
}
|
|
|
|
|
|
|
|
int32_t nsCommandParams::GetInt(const char* aName, ErrorResult& aRv) const {
|
|
|
|
MOZ_ASSERT(!aRv.Failed());
|
|
|
|
|
2014-08-25 23:20:01 +00:00
|
|
|
HashEntry* foundEntry = GetNamedEntry(aName);
|
|
|
|
if (foundEntry && foundEntry->mEntryType == eLongType) {
|
2018-07-10 09:48:43 +00:00
|
|
|
return foundEntry->mData.mLong;
|
2001-04-06 01:27:53 +00:00
|
|
|
}
|
2018-07-10 09:48:43 +00:00
|
|
|
aRv.Throw(NS_ERROR_FAILURE);
|
|
|
|
return 0;
|
2001-04-06 01:27:53 +00:00
|
|
|
}
|
|
|
|
|
2014-08-25 23:20:01 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsCommandParams::GetDoubleValue(const char* aName, double* aRetVal) {
|
|
|
|
NS_ENSURE_ARG_POINTER(aRetVal);
|
2001-04-06 01:27:53 +00:00
|
|
|
|
2018-07-10 09:48:43 +00:00
|
|
|
ErrorResult error;
|
|
|
|
*aRetVal = GetDouble(aName, error);
|
|
|
|
return error.StealNSResult();
|
|
|
|
}
|
|
|
|
|
|
|
|
double nsCommandParams::GetDouble(const char* aName, ErrorResult& aRv) const {
|
|
|
|
MOZ_ASSERT(!aRv.Failed());
|
|
|
|
|
2014-08-25 23:20:01 +00:00
|
|
|
HashEntry* foundEntry = GetNamedEntry(aName);
|
|
|
|
if (foundEntry && foundEntry->mEntryType == eDoubleType) {
|
2018-07-10 09:48:43 +00:00
|
|
|
return foundEntry->mData.mDouble;
|
2001-04-06 01:27:53 +00:00
|
|
|
}
|
2018-07-10 09:48:43 +00:00
|
|
|
aRv.Throw(NS_ERROR_FAILURE);
|
|
|
|
return 0.0;
|
2001-04-06 01:27:53 +00:00
|
|
|
}
|
|
|
|
|
2014-08-25 23:20:01 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsCommandParams::GetStringValue(const char* aName, nsAString& aRetVal) {
|
2018-07-10 09:48:43 +00:00
|
|
|
return GetString(aName, aRetVal);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult nsCommandParams::GetString(const char* aName,
|
|
|
|
nsAString& aRetVal) const {
|
2014-08-25 23:20:01 +00:00
|
|
|
HashEntry* foundEntry = GetNamedEntry(aName);
|
|
|
|
if (foundEntry && foundEntry->mEntryType == eWStringType) {
|
2002-09-12 22:09:45 +00:00
|
|
|
NS_ASSERTION(foundEntry->mData.mString, "Null string");
|
2014-08-25 23:20:01 +00:00
|
|
|
aRetVal.Assign(*foundEntry->mData.mString);
|
2001-04-06 01:27:53 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2014-08-25 23:20:01 +00:00
|
|
|
aRetVal.Truncate();
|
2001-04-06 01:27:53 +00:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2014-08-25 23:20:01 +00:00
|
|
|
NS_IMETHODIMP
|
2018-07-10 09:04:46 +00:00
|
|
|
nsCommandParams::GetCStringValue(const char* aName, nsACString& aRetVal) {
|
2018-07-10 09:48:43 +00:00
|
|
|
return GetCString(aName, aRetVal);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult nsCommandParams::GetCString(const char* aName,
|
|
|
|
nsACString& aRetVal) const {
|
2014-08-25 23:20:01 +00:00
|
|
|
HashEntry* foundEntry = GetNamedEntry(aName);
|
|
|
|
if (foundEntry && foundEntry->mEntryType == eStringType) {
|
2002-09-12 22:09:45 +00:00
|
|
|
NS_ASSERTION(foundEntry->mData.mCString, "Null string");
|
2018-07-10 09:04:46 +00:00
|
|
|
aRetVal.Assign(*foundEntry->mData.mCString);
|
2002-07-15 22:04:13 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2018-07-10 09:04:46 +00:00
|
|
|
aRetVal.Truncate();
|
2002-07-15 22:04:13 +00:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
2014-08-25 23:20:01 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsCommandParams::GetISupportsValue(const char* aName, nsISupports** aRetVal) {
|
|
|
|
NS_ENSURE_ARG_POINTER(aRetVal);
|
2001-04-06 01:27:53 +00:00
|
|
|
|
2018-07-10 09:48:43 +00:00
|
|
|
ErrorResult error;
|
|
|
|
nsCOMPtr<nsISupports> result = GetISupports(aName, error);
|
|
|
|
if (result) {
|
|
|
|
result.forget(aRetVal);
|
|
|
|
} else {
|
|
|
|
*aRetVal = nullptr;
|
|
|
|
}
|
|
|
|
return error.StealNSResult();
|
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<nsISupports> nsCommandParams::GetISupports(
|
|
|
|
const char* aName, ErrorResult& aRv) const {
|
|
|
|
MOZ_ASSERT(!aRv.Failed());
|
|
|
|
|
2014-08-25 23:20:01 +00:00
|
|
|
HashEntry* foundEntry = GetNamedEntry(aName);
|
|
|
|
if (foundEntry && foundEntry->mEntryType == eISupportsType) {
|
2018-07-10 09:48:43 +00:00
|
|
|
nsCOMPtr<nsISupports> result = foundEntry->mISupports;
|
|
|
|
return result.forget();
|
2001-04-06 01:27:53 +00:00
|
|
|
}
|
2018-07-10 09:48:43 +00:00
|
|
|
aRv.Throw(NS_ERROR_FAILURE);
|
|
|
|
return nullptr;
|
2001-04-06 01:27:53 +00:00
|
|
|
}
|
|
|
|
|
2014-08-25 23:20:01 +00:00
|
|
|
NS_IMETHODIMP
|
2015-05-11 19:35:14 +00:00
|
|
|
nsCommandParams::SetBooleanValue(const char* aName, bool aValue) {
|
2018-07-10 09:48:43 +00:00
|
|
|
return SetBool(aName, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult nsCommandParams::SetBool(const char* aName, bool aValue) {
|
2014-08-25 23:20:01 +00:00
|
|
|
HashEntry* foundEntry = GetOrMakeEntry(aName, eBooleanType);
|
2014-08-17 22:42:20 +00:00
|
|
|
if (!foundEntry) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2015-05-11 19:35:14 +00:00
|
|
|
foundEntry->mData.mBoolean = aValue;
|
2001-04-06 01:27:53 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2014-08-25 23:20:01 +00:00
|
|
|
NS_IMETHODIMP
|
2015-05-11 19:35:14 +00:00
|
|
|
nsCommandParams::SetLongValue(const char* aName, int32_t aValue) {
|
2018-07-10 09:48:43 +00:00
|
|
|
return SetInt(aName, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult nsCommandParams::SetInt(const char* aName, int32_t aValue) {
|
2014-08-25 23:20:01 +00:00
|
|
|
HashEntry* foundEntry = GetOrMakeEntry(aName, eLongType);
|
2014-08-17 22:42:20 +00:00
|
|
|
if (!foundEntry) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2015-05-11 19:35:14 +00:00
|
|
|
foundEntry->mData.mLong = aValue;
|
2001-04-06 01:27:53 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2014-08-25 23:20:01 +00:00
|
|
|
NS_IMETHODIMP
|
2015-05-11 19:35:14 +00:00
|
|
|
nsCommandParams::SetDoubleValue(const char* aName, double aValue) {
|
2018-07-10 09:48:43 +00:00
|
|
|
return SetDouble(aName, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult nsCommandParams::SetDouble(const char* aName, double aValue) {
|
2014-08-25 23:20:01 +00:00
|
|
|
HashEntry* foundEntry = GetOrMakeEntry(aName, eDoubleType);
|
2014-08-17 22:42:20 +00:00
|
|
|
if (!foundEntry) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2015-05-11 19:35:14 +00:00
|
|
|
foundEntry->mData.mDouble = aValue;
|
2001-04-06 01:27:53 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2014-08-25 23:20:01 +00:00
|
|
|
NS_IMETHODIMP
|
2015-05-11 19:35:14 +00:00
|
|
|
nsCommandParams::SetStringValue(const char* aName, const nsAString& aValue) {
|
2018-07-10 09:48:43 +00:00
|
|
|
return SetString(aName, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult nsCommandParams::SetString(const char* aName,
|
|
|
|
const nsAString& aValue) {
|
2014-08-25 23:20:01 +00:00
|
|
|
HashEntry* foundEntry = GetOrMakeEntry(aName, eWStringType);
|
2014-08-17 22:42:20 +00:00
|
|
|
if (!foundEntry) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2015-05-11 19:35:14 +00:00
|
|
|
foundEntry->mData.mString = new nsString(aValue);
|
2001-04-06 01:27:53 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2014-08-25 23:20:01 +00:00
|
|
|
NS_IMETHODIMP
|
2018-07-10 09:04:46 +00:00
|
|
|
nsCommandParams::SetCStringValue(const char* aName, const nsACString& aValue) {
|
2018-07-10 09:48:43 +00:00
|
|
|
return SetCString(aName, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult nsCommandParams::SetCString(const char* aName,
|
|
|
|
const nsACString& aValue) {
|
2014-08-25 23:20:01 +00:00
|
|
|
HashEntry* foundEntry = GetOrMakeEntry(aName, eStringType);
|
2014-08-17 22:42:20 +00:00
|
|
|
if (!foundEntry) {
|
2002-07-15 22:04:13 +00:00
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
2014-08-17 22:42:20 +00:00
|
|
|
}
|
2015-05-11 19:35:14 +00:00
|
|
|
foundEntry->mData.mCString = new nsCString(aValue);
|
2002-07-15 22:04:13 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2014-08-25 23:20:01 +00:00
|
|
|
NS_IMETHODIMP
|
2015-05-11 19:35:14 +00:00
|
|
|
nsCommandParams::SetISupportsValue(const char* aName, nsISupports* aValue) {
|
2018-07-10 09:48:43 +00:00
|
|
|
return SetISupports(aName, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult nsCommandParams::SetISupports(const char* aName, nsISupports* aValue) {
|
2014-08-25 23:20:01 +00:00
|
|
|
HashEntry* foundEntry = GetOrMakeEntry(aName, eISupportsType);
|
2014-08-17 22:42:20 +00:00
|
|
|
if (!foundEntry) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2015-05-11 19:35:14 +00:00
|
|
|
foundEntry->mISupports = aValue; // addrefs
|
2001-04-06 01:27:53 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2014-08-25 23:20:01 +00:00
|
|
|
nsCommandParams::RemoveValue(const char* aName) {
|
2015-09-14 21:23:24 +00:00
|
|
|
mValuesHash.Remove((void*)aName);
|
2001-04-06 01:27:53 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2018-07-10 09:48:43 +00:00
|
|
|
nsCommandParams::HashEntry* nsCommandParams::GetNamedEntry(
|
|
|
|
const char* aName) const {
|
2018-07-13 10:01:53 +00:00
|
|
|
return static_cast<HashEntry*>(mValuesHash.Search((void*)aName));
|
2001-04-06 01:27:53 +00:00
|
|
|
}
|
|
|
|
|
2015-05-11 19:35:14 +00:00
|
|
|
nsCommandParams::HashEntry* nsCommandParams::GetOrMakeEntry(
|
|
|
|
const char* aName, uint8_t aEntryType) {
|
2015-05-21 07:34:25 +00:00
|
|
|
auto foundEntry = static_cast<HashEntry*>(mValuesHash.Search((void*)aName));
|
2015-01-23 05:06:55 +00:00
|
|
|
if (foundEntry) { // reuse existing entry
|
2015-05-11 19:35:14 +00:00
|
|
|
foundEntry->Reset(aEntryType);
|
2014-08-17 22:42:20 +00:00
|
|
|
return foundEntry;
|
2001-04-06 01:27:53 +00:00
|
|
|
}
|
|
|
|
|
2015-09-14 21:23:12 +00:00
|
|
|
foundEntry = static_cast<HashEntry*>(mValuesHash.Add((void*)aName, fallible));
|
2014-08-17 22:42:20 +00:00
|
|
|
if (!foundEntry) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2014-08-25 23:20:01 +00:00
|
|
|
// Use placement new. Our ctor does not clobber keyHash, which is important.
|
2015-05-11 19:35:14 +00:00
|
|
|
new (foundEntry) HashEntry(aEntryType, aName);
|
2014-08-17 22:42:20 +00:00
|
|
|
return foundEntry;
|
2001-04-06 01:27:53 +00:00
|
|
|
}
|
|
|
|
|
2016-03-16 04:33:44 +00:00
|
|
|
PLDHashNumber nsCommandParams::HashKey(const void* aKey) {
|
2015-05-11 19:35:14 +00:00
|
|
|
return HashString((const char*)aKey);
|
2001-04-06 01:27:53 +00:00
|
|
|
}
|
|
|
|
|
2016-03-16 04:33:44 +00:00
|
|
|
bool nsCommandParams::HashMatchEntry(const PLDHashEntryHdr* aEntry,
|
|
|
|
const void* aKey) {
|
2014-08-25 23:20:01 +00:00
|
|
|
const char* keyString = (const char*)aKey;
|
|
|
|
const HashEntry* thisEntry = static_cast<const HashEntry*>(aEntry);
|
2001-04-06 01:27:53 +00:00
|
|
|
return thisEntry->mEntryName.Equals(keyString);
|
|
|
|
}
|
|
|
|
|
2015-05-11 19:35:14 +00:00
|
|
|
void nsCommandParams::HashMoveEntry(PLDHashTable* aTable,
|
|
|
|
const PLDHashEntryHdr* aFrom,
|
|
|
|
PLDHashEntryHdr* aTo) {
|
Bug 1415980 - make hash keys movable and not copyable; r=erahm
Everything that goes in a PLDHashtable (and its derivatives, like
nsTHashtable) needs to inherit from PLDHashEntryHdr. But through a lack
of enforcement, copy constructors for these derived classes didn't
explicitly invoke the copy constructor for PLDHashEntryHdr (and the
compiler didn't invoke the copy constructor for us). Instead,
PLDHashTable explicitly copied around the bits that the copy constructor
would have.
The current setup has two problems:
1) Derived classes should be using move construction, not copy
construction, since anything that's shuffling hash table keys/entries
around will be using move construction.
2) Derived classes should take responsibility for transferring bits of
superclass state around, and not rely on something else to handle that.
The second point is not a huge problem for PLDHashTable (PLDHashTable
only has to copy PLDHashEntryHdr's bits in a single place), but future
hash table implementations that might move entries around more
aggressively would have to insert compensation code all over the
place. Additionally, if moving entries is implemented via memcpy (which
is quite common), PLDHashTable copying around bits *again* is
inefficient.
Let's fix all these problems in one go, by:
1) Explicitly declaring the set of constructors that PLDHashEntryHdr
implements (and does not implement). In particular, the copy
constructor is deleted, so any derived classes that attempt to make
themselves copyable will be detected at compile time: the compiler
will complain that the superclass type is not copyable.
This change on its own will result in many compiler errors, so...
2) Change any derived classes to implement move constructors instead of
copy constructors. Note that some of these move constructors are,
strictly speaking, unnecessary, since the relevant classes are moved
via memcpy in nsTHashtable and its derivatives.
2018-09-20 15:20:36 +00:00
|
|
|
auto* fromEntry =
|
|
|
|
const_cast<HashEntry*>(static_cast<const HashEntry*>(aFrom));
|
2014-08-25 23:20:01 +00:00
|
|
|
HashEntry* toEntry = static_cast<HashEntry*>(aTo);
|
2014-08-17 22:42:20 +00:00
|
|
|
|
Bug 1415980 - make hash keys movable and not copyable; r=erahm
Everything that goes in a PLDHashtable (and its derivatives, like
nsTHashtable) needs to inherit from PLDHashEntryHdr. But through a lack
of enforcement, copy constructors for these derived classes didn't
explicitly invoke the copy constructor for PLDHashEntryHdr (and the
compiler didn't invoke the copy constructor for us). Instead,
PLDHashTable explicitly copied around the bits that the copy constructor
would have.
The current setup has two problems:
1) Derived classes should be using move construction, not copy
construction, since anything that's shuffling hash table keys/entries
around will be using move construction.
2) Derived classes should take responsibility for transferring bits of
superclass state around, and not rely on something else to handle that.
The second point is not a huge problem for PLDHashTable (PLDHashTable
only has to copy PLDHashEntryHdr's bits in a single place), but future
hash table implementations that might move entries around more
aggressively would have to insert compensation code all over the
place. Additionally, if moving entries is implemented via memcpy (which
is quite common), PLDHashTable copying around bits *again* is
inefficient.
Let's fix all these problems in one go, by:
1) Explicitly declaring the set of constructors that PLDHashEntryHdr
implements (and does not implement). In particular, the copy
constructor is deleted, so any derived classes that attempt to make
themselves copyable will be detected at compile time: the compiler
will complain that the superclass type is not copyable.
This change on its own will result in many compiler errors, so...
2) Change any derived classes to implement move constructors instead of
copy constructors. Note that some of these move constructors are,
strictly speaking, unnecessary, since the relevant classes are moved
via memcpy in nsTHashtable and its derivatives.
2018-09-20 15:20:36 +00:00
|
|
|
new (KnownNotNull, toEntry) HashEntry(std::move(*fromEntry));
|
2014-08-17 22:42:20 +00:00
|
|
|
|
2015-05-11 19:35:14 +00:00
|
|
|
fromEntry->~HashEntry();
|
2001-04-06 01:27:53 +00:00
|
|
|
}
|
|
|
|
|
2015-05-11 19:35:14 +00:00
|
|
|
void nsCommandParams::HashClearEntry(PLDHashTable* aTable,
|
|
|
|
PLDHashEntryHdr* aEntry) {
|
2014-08-25 23:20:01 +00:00
|
|
|
HashEntry* thisEntry = static_cast<HashEntry*>(aEntry);
|
2015-05-11 19:35:14 +00:00
|
|
|
thisEntry->~HashEntry();
|
2001-04-06 01:27:53 +00:00
|
|
|
}
|