Bug 1922838 - Replace ArrayLength, ArrayEnd and MOZ_ARRAY_LENGTH by standard alternative r=glandium,necko-reviewers,jgilbert,application-update-reviewers,media-playback-reviewers,credential-management-reviewers,anti-tracking-reviewers,places-reviewers,profiler-reviewers,win-reviewers,dom-storage-reviewers,bytesized,janv,dimi,daisuke,karlt,gstoll,canaltinova,timhuang

Namely std::size, std::end and std::size. This drops C support for
MOZ_ARRAY_LENGTH but it wasn't used anyway.

Differential Revision: https://phabricator.services.mozilla.com/D224611
This commit is contained in:
serge-sans-paille
2024-10-24 07:38:30 +00:00
parent 6b307b0556
commit 2c916d4973
370 changed files with 1113 additions and 1275 deletions

View File

@@ -178,7 +178,7 @@ static const nsAttrValue::EnumTable kInputTypeTable[] = {
// Default type is 'text'.
static const nsAttrValue::EnumTable* kInputDefaultType =
&kInputTypeTable[ArrayLength(kInputTypeTable) - 2];
&kInputTypeTable[std::size(kInputTypeTable) - 2];
static const nsAttrValue::EnumTable kCaptureTable[] = {
{"user", nsIFilePicker::captureUser},
@@ -5418,12 +5418,12 @@ bool HTMLInputElement::ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
FormControlType(kInputDefaultType->value) == FormControlType::InputText,
"Someone forgot to update kInputDefaultType when adding a new "
"input type.");
MOZ_ASSERT(kInputTypeTable[ArrayLength(kInputTypeTable) - 1].tag == nullptr,
MOZ_ASSERT(kInputTypeTable[std::size(kInputTypeTable) - 1].tag == nullptr,
"Last entry in the table must be the nullptr guard");
MOZ_ASSERT(FormControlType(
kInputTypeTable[ArrayLength(kInputTypeTable) - 2].value) ==
FormControlType::InputText,
"Next to last entry in the table must be the \"text\" entry");
MOZ_ASSERT(
FormControlType(kInputTypeTable[std::size(kInputTypeTable) - 2].value) ==
FormControlType::InputText,
"Next to last entry in the table must be the \"text\" entry");
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::type) {