gecko/dom/xul/templates/nsContentSupportMap.cpp
Nicholas Nethercote c0a8a6e993 Bug 1123151 (part 2) - Add PLDHashTable::IsInitialized(). r=froydnj.
This encapsulates most of the uses of PLDHashTable::ops.

--HG--
extra : rebase_source : 7760ce8e46a37e87dcfe590e809a21df01fe510f
2015-01-19 16:11:34 -08:00

38 lines
866 B
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* 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/. */
#include "nsContentSupportMap.h"
#include "nsXULElement.h"
void
nsContentSupportMap::Init()
{
PL_DHashTableInit(&mMap, PL_DHashGetStubOps(), sizeof(Entry));
}
void
nsContentSupportMap::Finish()
{
if (mMap.IsInitialized())
PL_DHashTableFinish(&mMap);
}
nsresult
nsContentSupportMap::Remove(nsIContent* aElement)
{
if (!mMap.IsInitialized())
return NS_ERROR_NOT_INITIALIZED;
nsIContent* child = aElement;
do {
PL_DHashTableRemove(&mMap, child);
child = child->GetNextNode(aElement);
} while(child);
return NS_OK;
}