5634: Fix clang tidy accessing data pointer r=def- a=ChillerDragon

ddnet/src/engine/client/favorites.cpp:229:23: error: 'data' should be
used for accessing the data pointer instead of taking the address of the
0-th element [readability-container-data-pointer,-warnings-as-errors]
        int Index = pEntry - &m_aEntries[0];
                             ^~~~~~~~~~~~~~
                             (m_aEntries).data()

<!-- What is the motivation for the changes of this pull request -->

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: ChillerDragon <ChillerDragon@gmail.com>
This commit is contained in:
bors[bot] 2022-07-18 14:28:43 +00:00 committed by GitHub
commit a9bc4ae113
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -226,7 +226,7 @@ const CFavorites::CEntry *CFavorites::Entry(const NETADDR &Addr) const
void CFavorites::RemoveEntry(CEntry *pEntry)
{
// Replace the entry
int Index = pEntry - &m_aEntries[0];
int Index = pEntry - m_aEntries.data();
*pEntry = m_aEntries[m_aEntries.size() - 1];
m_aEntries.pop_back();
if(Index != (int)m_aEntries.size())