@@ -492,14 +492,12 @@ class nsTArray_base {
492492 // Tries to resize the storage to the minimum required amount. If this fails,
493493 // the array is left as-is.
494494 // @param aElemSize The size of an array element.
495- // @param aElemAlign The alignment in bytes of an array element.
496- void ShrinkCapacity (size_type aElemSize, size_t aElemAlign);
495+ void ShrinkCapacity (size_type aElemSize);
497496
498497 // Resizes the storage to 0. This may only be called when Length() is already
499498 // 0.
500499 // @param aElemSize The size of an array element.
501- // @param aElemAlign The alignment in bytes of an array element.
502- void ShrinkCapacityToZero (size_type aElemSize, size_t aElemAlign);
500+ void ShrinkCapacityToZero (size_type aElemSize);
503501
504502 // This method may be called to resize a "gap" in the array by shifting
505503 // elements around. It updates mLength appropriately. If the resulting
@@ -508,21 +506,18 @@ class nsTArray_base {
508506 // @param aOldLen The current length of the gap.
509507 // @param aNewLen The desired length of the gap.
510508 // @param aElemSize The size of an array element.
511- // @param aElemAlign The alignment in bytes of an array element.
512509 template <typename ActualAlloc>
513510 void ShiftData (index_type aStart, size_type aOldLen, size_type aNewLen,
514- size_type aElemSize, size_t aElemAlign );
511+ size_type aElemSize);
515512
516513 // This method may be called to swap elements from the end of the array to
517514 // fill a "gap" in the array. If the resulting array has zero elements, then
518515 // the array's memory is free'd.
519516 // @param aStart The starting index of the gap.
520517 // @param aCount The length of the gap.
521518 // @param aElemSize The size of an array element.
522- // @param aElemAlign The alignment in bytes of an array element.
523519 template <typename ActualAlloc>
524- void SwapFromEnd (index_type aStart, size_type aCount, size_type aElemSize,
525- size_t aElemAlign);
520+ void SwapFromEnd (index_type aStart, size_type aCount, size_type aElemSize);
526521
527522 // This method increments the length member of the array's header.
528523 // Note that mHdr may actually be sEmptyTArrayHeader in the case where a
@@ -544,26 +539,24 @@ class nsTArray_base {
544539 // greater than the current length of the array.
545540 // @param aCount the number of slots to insert
546541 // @param aElementSize the size of an array element.
547- // @param aElemAlign the alignment in bytes of an array element.
548542 template <typename ActualAlloc>
549543 typename ActualAlloc::ResultTypeProxy InsertSlotsAt (index_type aIndex,
550544 size_type aCount,
551- size_type aElementSize,
552- size_t aElemAlign);
545+ size_type aElementSize);
553546
554547 template <typename ActualAlloc, class Allocator >
555548 typename ActualAlloc::ResultTypeProxy SwapArrayElements (
556- nsTArray_base<Allocator, RelocationStrategy>& aOther, size_type aElemSize,
557- size_t aElemAlign );
549+ nsTArray_base<Allocator, RelocationStrategy>& aOther,
550+ size_type aElemSize );
558551
559552 template <class Allocator >
560553 void MoveConstructNonAutoArray (
561- nsTArray_base<Allocator, RelocationStrategy>& aOther, size_type aElemSize,
562- size_t aElemAlign );
554+ nsTArray_base<Allocator, RelocationStrategy>& aOther,
555+ size_type aElemSize );
563556
564557 template <class Allocator >
565558 void MoveInit (nsTArray_base<Allocator, RelocationStrategy>& aOther,
566- size_type aElemSize, size_t aElemAlign );
559+ size_type aElemSize);
567560
568561 // Helper function for move construction and SwapArrayElements.
569562 // Takes the storage from the nsTArray as a non-auto Header pointer.
@@ -1036,8 +1029,7 @@ class nsTArray_Impl
10361029 MOZ_ASSERT (!this ->UsesAutoArrayBuffer ());
10371030
10381031 // This does not use SwapArrayElements because that's unnecessarily complex.
1039- this ->MoveConstructNonAutoArray (aOther, sizeof (value_type),
1040- alignof (value_type));
1032+ this ->MoveConstructNonAutoArray (aOther, sizeof (value_type));
10411033 }
10421034
10431035 // The array's copy-constructor performs a 'deep' copy of the given array.
@@ -1082,7 +1074,7 @@ class nsTArray_Impl
10821074 self_type& operator =(self_type&& aOther) {
10831075 if (this != &aOther) {
10841076 Clear ();
1085- this ->MoveInit (aOther, sizeof (value_type), alignof (value_type) );
1077+ this ->MoveInit (aOther, sizeof (value_type));
10861078 }
10871079 return *this ;
10881080 }
@@ -1128,7 +1120,7 @@ class nsTArray_Impl
11281120 template <typename Allocator>
11291121 self_type& operator =(nsTArray_Impl<E, Allocator>&& aOther) {
11301122 Clear ();
1131- this ->MoveInit (aOther, sizeof (value_type), alignof (value_type) );
1123+ this ->MoveInit (aOther, sizeof (value_type));
11321124 return *this ;
11331125 }
11341126
@@ -1447,7 +1439,7 @@ class nsTArray_Impl
14471439 template <class Allocator >
14481440 void Assign (nsTArray_Impl<E, Allocator>&& aOther) {
14491441 Clear ();
1450- this ->MoveInit (aOther, sizeof (value_type), alignof (value_type) );
1442+ this ->MoveInit (aOther, sizeof (value_type));
14511443 }
14521444
14531445 // This method call the destructor on each element of the array, empties it,
@@ -1922,7 +1914,7 @@ class nsTArray_Impl
19221914
19231915 void Clear () {
19241916 ClearAndRetainStorage ();
1925- base_type::ShrinkCapacityToZero (sizeof (value_type), alignof (value_type) );
1917+ base_type::ShrinkCapacityToZero (sizeof (value_type));
19261918 }
19271919
19281920 // This method removes elements based on the return value of the
@@ -1987,8 +1979,8 @@ class nsTArray_Impl
19871979 // The only case this might fail were if someone called this with a
19881980 // AutoTArray upcast to nsTArray_Impl, under the conditions mentioned in the
19891981 // overload for AutoTArray below.
1990- this ->template SwapArrayElements <InfallibleAlloc>(
1991- aOther, sizeof (value_type), alignof (value_type));
1982+ this ->template SwapArrayElements <InfallibleAlloc>(aOther,
1983+ sizeof (value_type));
19921984 }
19931985
19941986 template <size_t N>
@@ -1998,8 +1990,8 @@ class nsTArray_Impl
19981990 // small inline sizes, and crash in the rare case of a small OOM error.
19991991 static_assert (!std::is_same_v<Alloc, FallibleAlloc> ||
20001992 sizeof (E) * N <= 1024 );
2001- this ->template SwapArrayElements <InfallibleAlloc>(
2002- aOther, sizeof (value_type), alignof (value_type));
1993+ this ->template SwapArrayElements <InfallibleAlloc>(aOther,
1994+ sizeof (value_type));
20031995 }
20041996
20051997 template <class Allocator >
@@ -2008,8 +2000,8 @@ class nsTArray_Impl
20082000 // Allocation might fail if Alloc==FallibleAlloc and
20092001 // Allocator==InfallibleAlloc and aOther uses auto storage.
20102002 return FallibleAlloc::Result (
2011- this ->template SwapArrayElements <FallibleAlloc>(
2012- aOther, sizeof (value_type), alignof (value_type)));
2003+ this ->template SwapArrayElements <FallibleAlloc>(aOther,
2004+ sizeof (value_type)));
20132005 }
20142006
20152007 private:
@@ -2285,7 +2277,7 @@ class nsTArray_Impl
22852277 template <typename ActualAlloc>
22862278 value_type* InsertElementsAtInternal (index_type aIndex, size_type aCount) {
22872279 if (!ActualAlloc::Successful (this ->template InsertSlotsAt <ActualAlloc>(
2288- aIndex, aCount, sizeof (value_type), alignof (value_type) ))) {
2280+ aIndex, aCount, sizeof (value_type)))) {
22892281 return nullptr ;
22902282 }
22912283
@@ -2328,7 +2320,7 @@ class nsTArray_Impl
23282320 }
23292321
23302322 // This method may be called to minimize the memory used by this array.
2331- void Compact () { ShrinkCapacity (sizeof (value_type), alignof (value_type) ); }
2323+ void Compact () { ShrinkCapacity (sizeof (value_type)); }
23322324
23332325 //
23342326 // Sorting
@@ -2472,8 +2464,8 @@ auto nsTArray_Impl<E, Alloc>::ReplaceElementsAtInternal(index_type aStart,
24722464 return nullptr ;
24732465 }
24742466 DestructRange (aStart, aCount);
2475- this ->template ShiftData <ActualAlloc>(
2476- aStart, aCount, aArrayLen, sizeof (value_type), alignof (value_type));
2467+ this ->template ShiftData <ActualAlloc>(aStart, aCount, aArrayLen,
2468+ sizeof (value_type));
24772469 AssignRange (aStart, aArrayLen, aArray);
24782470 return Elements () + aStart;
24792471}
@@ -2497,8 +2489,8 @@ template <typename E, class Alloc>
24972489void nsTArray_Impl<E, Alloc>::RemoveElementsAtUnsafe(index_type aStart,
24982490 size_type aCount) {
24992491 DestructRange (aStart, aCount);
2500- this ->template ShiftData <InfallibleAlloc>(
2501- aStart, aCount, 0 , sizeof (value_type), alignof (value_type));
2492+ this ->template ShiftData <InfallibleAlloc>(aStart, aCount, 0 ,
2493+ sizeof (value_type));
25022494}
25032495
25042496template <typename E, class Alloc >
@@ -2517,8 +2509,8 @@ void nsTArray_Impl<E, Alloc>::UnorderedRemoveElementsAt(index_type aStart,
25172509 // replace them from the end. See the docs on the declaration of this
25182510 // function.
25192511 DestructRange (aStart, aCount);
2520- this ->template SwapFromEnd <InfallibleAlloc>(
2521- aStart, aCount, sizeof (value_type), alignof (value_type));
2512+ this ->template SwapFromEnd <InfallibleAlloc>(aStart, aCount,
2513+ sizeof (value_type));
25222514}
25232515
25242516template <typename E, class Alloc >
@@ -2561,7 +2553,7 @@ auto nsTArray_Impl<E, Alloc>::InsertElementsAtInternal(index_type aIndex,
25612553 const Item& aItem)
25622554 -> value_type* {
25632555 if (!ActualAlloc::Successful (this ->template InsertSlotsAt <ActualAlloc>(
2564- aIndex, aCount, sizeof (value_type), alignof (value_type) ))) {
2556+ aIndex, aCount, sizeof (value_type)))) {
25652557 return nullptr ;
25662558 }
25672559
@@ -2588,8 +2580,7 @@ auto nsTArray_Impl<E, Alloc>::InsertElementAtInternal(index_type aIndex)
25882580 Length () + 1 , sizeof (value_type)))) {
25892581 return nullptr ;
25902582 }
2591- this ->template ShiftData <ActualAlloc>(aIndex, 0 , 1 , sizeof (value_type),
2592- alignof (value_type));
2583+ this ->template ShiftData <ActualAlloc>(aIndex, 0 , 1 , sizeof (value_type));
25932584 value_type* elem = Elements () + aIndex;
25942585 elem_traits::Construct (elem);
25952586 return elem;
@@ -2609,8 +2600,7 @@ auto nsTArray_Impl<E, Alloc>::InsertElementAtInternal(index_type aIndex,
26092600 Length () + 1 , sizeof (value_type)))) {
26102601 return nullptr ;
26112602 }
2612- this ->template ShiftData <ActualAlloc>(aIndex, 0 , 1 , sizeof (value_type),
2613- alignof (value_type));
2603+ this ->template ShiftData <ActualAlloc>(aIndex, 0 , 1 , sizeof (value_type));
26142604 value_type* elem = Elements () + aIndex;
26152605 elem_traits::Construct (elem, std::forward<Item>(aItem));
26162606 return elem;
@@ -2641,8 +2631,8 @@ auto nsTArray_Impl<E, Alloc>::AppendElementsInternal(
26412631 if (Length () == 0 ) {
26422632 // XXX This might still be optimized. If aArray uses auto-storage but we
26432633 // won't, we might better retain our storage if it's sufficiently large.
2644- this ->ShrinkCapacityToZero (sizeof (value_type), alignof (value_type) );
2645- this ->MoveInit (aArray, sizeof (value_type), alignof (value_type) );
2634+ this ->ShrinkCapacityToZero (sizeof (value_type));
2635+ this ->MoveInit (aArray, sizeof (value_type));
26462636 return Elements ();
26472637 }
26482638
@@ -2655,8 +2645,7 @@ auto nsTArray_Impl<E, Alloc>::AppendElementsInternal(
26552645 relocation_type::RelocateNonOverlappingRegion (
26562646 Elements () + len, aArray.Elements (), otherLen, sizeof (value_type));
26572647 this ->IncrementLength (otherLen);
2658- aArray.template ShiftData <ActualAlloc>(0 , otherLen, 0 , sizeof (value_type),
2659- alignof (value_type));
2648+ aArray.template ShiftData <ActualAlloc>(0 , otherLen, 0 , sizeof (value_type));
26602649 return Elements () + len;
26612650}
26622651
@@ -3021,18 +3010,18 @@ class MOZ_NON_MEMMOVABLE MOZ_GSL_OWNER AutoTArray : public nsTArray<E> {
30213010
30223011 AutoTArray (self_type&& aOther) : nsTArray<E>() {
30233012 Init ();
3024- this ->MoveInit (aOther, sizeof (value_type), alignof (value_type) );
3013+ this ->MoveInit (aOther, sizeof (value_type));
30253014 }
30263015
30273016 explicit AutoTArray (base_type&& aOther) : mAlign() {
30283017 Init ();
3029- this ->MoveInit (aOther, sizeof (value_type), alignof (value_type) );
3018+ this ->MoveInit (aOther, sizeof (value_type));
30303019 }
30313020
30323021 template <typename Allocator>
30333022 explicit AutoTArray (nsTArray_Impl<value_type, Allocator>&& aOther) {
30343023 Init ();
3035- this ->MoveInit (aOther, sizeof (value_type), alignof (value_type) );
3024+ this ->MoveInit (aOther, sizeof (value_type));
30363025 }
30373026
30383027 MOZ_IMPLICIT AutoTArray (std::initializer_list<E> aIL) : mAlign() {
0 commit comments