On 06/01/2021 09:34, Marton Balint wrote:
On Wed, 6 Jan 2021, Andreas Rheinhardt wrote:
When the difference of the longest size and the average size of
collection of strings is smaller than the size of a pointer, it makes
sense to store the strings directly in an array instead of using an
array of pointers to strings (unless doing so precludes deduplicating
strings); doing so also avoids relocations. This requirement is
fulfilled for several arrays of pointers to strings that are changed in
this commit.
Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@gmail.com>
---
Now used sizeof("longest string") for the array element size.
Duplicating the "longest string" is very ugly, I don't find it better than a
constant number, because a sizeof still does not say it tries to find the longest string.
TBH I am not a fan of these kind of patches for a few byte of savings, and when
changing the list of strings it can actually become worse which won't be
checked by anybody...
I'm inclined to agree.
This case is particularly evil because the compiler is unable to detect
off-by-one errors, so missing the longest element may silently result in
messed-up strings and crashes.
- Mark
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".