Commit Graph

959 Commits

Author SHA1 Message Date
Max Kellermann b745d1f226 util/StringCompare: add `constexpr` 2024-10-30 21:29:16 +01:00
Max Kellermann 52e2130d51 util/StringCompare: simplify StringIsEqual() using operator== 2024-10-30 21:28:15 +01:00
Max Kellermann 32dd9704ce util/DeleteDisposer: add `const` and `noexcept` 2024-09-04 17:24:42 +02:00
Max Kellermann 523519182a util/IntrusiveHashSet: add concept checks 2024-09-04 17:24:24 +02:00
Max Kellermann 4a2fff019a util/DisposablePointer: suppress -Wuninitialized
I pretend to know what I'm doing :-)
2024-08-30 12:23:45 +02:00
Max Kellermann dbaa72cb40 util/CircularBuffer: use std::span internally 2024-07-29 22:24:54 +02:00
Max Kellermann 596d2d93dd util/CircularBuffer: use `using` instead of `typedef` 2024-07-29 22:21:38 +02:00
Max Kellermann 10311b3a65 util/CircularBuffer: explicitly forbid the copy operator 2024-07-29 22:20:15 +02:00
Max Kellermann 332ba42073 util/HugeAllocator: add std::span cast operator 2024-07-29 22:20:12 +02:00
Max Kellermann 4262d29965 util/HugeAllocator: add `constexpr` 2024-07-29 22:19:28 +02:00
Max Kellermann 0899d80ae0 util/CircularBuffer: add `noexcept` and `constexpr` 2024-07-29 22:14:59 +02:00
Max Kellermann 9fe6493fc2 util/CircularBuffer: use inline initializer 2024-07-29 22:13:50 +02:00
Max Kellermann bc758cece0 util/StringPointer: remove unnecessary operator!=()
The compiler must generate this implicitly from operator==().
2024-07-23 13:04:37 +02:00
Max Kellermann 0e4885c1fa util/IterableSplitString: remove unnecessary operator!=()
The compiler must generate this implicitly from operator==().
2024-07-23 13:04:30 +02:00
Max Kellermann 9944c97203 util/AllocatedString: remove unnecessary operator!=()
The compiler must generate this implicitly from operator==().
2024-07-23 13:04:20 +02:00
Max Kellermann 58a5550439 util/AllocatedArray: remove unnecessary operator!=()
The compiler must generate this implicitly from operator==().
2024-07-23 13:04:10 +02:00
Max Kellermann f6a687dc2b util/FilteredContainer: new class 2024-07-11 15:30:30 +02:00
Max Kellermann 9210705598 util/TerminatedArray: new class 2024-07-11 15:30:30 +02:00
Max Kellermann 3d995bba5f util/DereferenceIterator: add class DereferenceContainerAdapter 2024-07-11 14:55:35 +02:00
Max Kellermann c77f5095d6 util/DereferenceIterator: allow comparing with sentinel end iterators 2024-07-11 14:55:35 +02:00
Max Kellermann 3701378449 util/DereferenceIterator: fix operator- and operator+ return types 2024-07-11 14:29:10 +02:00
Max Kellermann cb9f3c1a5b util/DereferenceIterator: optimize and simplify increment/decrement operators 2024-07-11 14:27:23 +02:00
Max Kellermann fe66cde616 util/DereferenceIterator: add `constexpr` 2024-07-10 20:13:24 +02:00
Max Kellermann 0cc9ef0aee util/DereferenceIterator: remove unnecessary operator!=()
The compiler must generate this implicitly from operator==().
2024-07-10 20:13:19 +02:00
Max Kellermann 68a424d9e1 util/DereferenceIterator: add missing `const` 2024-07-10 20:11:55 +02:00
Max Kellermann bd59c889f3 util/StringVerify: new library 2024-07-08 16:02:40 +02:00
Max Kellermann 7b938b4d14 util/Exception: sanitize message strings
This should prevent leaking unsanitized strings from libraries.
2024-06-25 20:29:07 +02:00
Max Kellermann a67f7f88e4 util/MimeType: add missing include 2024-05-23 20:31:10 +02:00
Max Kellermann ec8f467585 util/Intrusive*: add IWYU pragmas 2024-05-23 20:30:50 +02:00
Max Kellermann 9e3a66d5bf util/djb_hash: make inline and constexpr
Allows calculating hashes at compile time.
2024-05-23 20:30:17 +02:00
Max Kellermann c7409d1e04 util/AllocatedString: add missing include 2024-05-23 20:22:44 +02:00
Max Kellermann f5092cb73d util/DisposablePointer: new class 2024-05-15 05:58:23 +02:00
Max Kellermann 416f65fe01 util/RoundPowerOfTwo: new library 2024-05-13 20:25:57 +02:00
Max Kellermann 1760310123 Revert "util/IntrusiveList: allow the last disposer to destroy the IntrusiveList"
This reverts commit 669cbcd25a
("util/IntrusiveList: allow the last disposer to destroy the
IntrusiveList").  It was bad because it could lead to off-by-one crash
bugs when the last item was removed inside the previous item's
disposer.

We need a different solution for the other crash bug that was fixed by
the reverted commit.
2024-05-06 12:49:30 +02:00
Max Kellermann 56d4784b11 util/IntrusiveList: add API documentation 2024-05-06 12:48:53 +02:00
Max Kellermann 7ebe56fdd9 util/SpanCast: allow ToStringView() only with integral char types
This avoids std::string_view specialization that make no sense.
2024-04-16 12:37:08 +02:00
Max Kellermann fae235197f util/SpanCast: allow ReferenceAsBytes() only with trivially-copyable
Addd the std::has_unique_object_representations_v constraint so we
cast stuff to std::byte only if this would make sense.
2024-04-16 12:33:36 +02:00
Max Kellermann b3a31b69ee util/RedBlackTree: fix lost "right" child while swapping with successor
Fixes a tree corruption bug that led to assertion failures.
2024-04-10 13:35:31 +02:00
Max Kellermann 88475f2e2b util/RedBlackTree: swap colors when swapping with successor
Swapping was incomplete without swapping the colors; this led to
assertion failures under certain conditions.
2024-04-10 13:35:28 +02:00
Max Kellermann e0a53d4747 util/IntrusiveTreeSet: add debug method Check()
Only for the unit test.
2024-04-10 13:35:21 +02:00
Max Kellermann 669cbcd25a util/IntrusiveList: allow the last disposer to destroy the IntrusiveList
Fixes a use-after-free bug in Co::MultiAwaitable::SetReady() when the
last callback frees the Co::MultiAwaitable owner.
2024-04-10 13:35:09 +02:00
Max Kellermann 2f7c19f139 util/SpanCast: rewrite ToStringView(std::span<std::byte>) to avoid cast ambiguities 2024-04-10 13:34:51 +02:00
Max Kellermann e131f22642 util/SpanCast: merge two ToStringView() using std::remove_const_t 2024-04-10 13:34:25 +02:00
Max Kellermann b6afdf1201 util/UriUtil: disable path segment stripping
This bug introduced by commit 49ed9dae34
and activated by commit acc1bd6297
caused leading spaces to disappear from the beginning of all file
names.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1961
2024-04-03 22:00:36 +02:00
Max Kellermann 99da022775 util/IntrusiveSortedList: remove unused class 2024-04-03 21:31:08 +02:00
Max Kellermann 5a0bad3b2f util/IntrusiveTreeSet: new class 2024-04-03 21:29:34 +02:00
Max Kellermann 6a99f20828 util/IntrusiveHashSet: add concept checks to *Operators
This requires adding another template argument and reordering the others.
2024-04-03 21:27:37 +02:00
Max Kellermann 1e5c37ee78 util/SpanCast: add ToStringView() with non-const std::byte
Without this, we would get std::string_view<std::byte> which makes no
sense.
2024-04-03 20:58:03 +02:00
Max Kellermann 02c4512b00 util/CharUtil: add IsLowerHexDigit() 2024-03-11 15:32:24 +01:00
Max Kellermann be84b189dc util, io, net, ...: use "#pragma once" 2024-03-11 15:32:24 +01:00