Ali Mohammad Pur
a1cb2c371a
AK+Kernel: OOM-harden most parts of Trie
...
The only part of Unveil that can't handle OOM gracefully is the
String::formatted() use in the node metadata.
2022-02-15 18:03:02 +02:00
Ali Mohammad Pur
80e6198563
AK: Conditionally disable a few variant ctors/assignments
...
We shouldn't let copy/move ctors or assignments be instantiated if the
assignee type does not have a copy/move constructor (even if they're not
used anywhere).
2022-02-15 18:03:02 +02:00
Ali Mohammad Pur
7a58c510e5
AK: Add a 'SpecializationOf' concept
...
The counterpart to the IsSpecializationOf<...> template.
2022-02-15 18:03:02 +02:00
Idan Horowitz
b32cf33a23
Kernel: Remove make_weak_ptr()
...
New users of WeakPtr in the kernel should use try_make_weak_ptr instead
2022-02-13 23:02:57 +01:00
Idan Horowitz
98c20b65cc
AK+Kernel: Add an OOM-fallible try variant make_weak_ptr()
...
This will allow us to propagate allocation errors that may be raised by
the construction of the WeakLink.
2022-02-13 23:02:57 +01:00
Idan Horowitz
d6ea6c39a7
AK+Kernel: Rename try_make_weak_ptr to make_weak_ptr_if_nonnull
...
This matches the likes of the adopt_{own, ref}_if_nonnull family and
also frees up the name to allow us to eventually add OOM-fallible
versions of these functions.
2022-02-13 23:02:57 +01:00
Andreas Kling
c74b6c06a5
AK: Use ByteBuffer::append(u8) in StringBuilder single-char append
2022-02-13 14:44:36 +01:00
Andreas Kling
22f6f0fc9e
AK: Don't call memcpy() in ByteBuffer::append(u8)
...
We can emit way nicer code for the just-append-a-single-byte case.
2022-02-13 14:44:36 +01:00
Idan Horowitz
871a53db76
AK: Make Bitmap construction OOM-fallible
2022-02-11 17:49:46 +02:00
davidot
fdbfe85a87
AK: Clear minimum when removing last node of RedBlackTree
2022-02-10 14:09:39 +00:00
davidot
2bddf157b1
AK: Fix RedBlackTree::find_smallest_not_below_iterator
...
Before this was incorrectly assuming that if the current node `n` was at
least the key and the left child of `n` was below the key that `n` was
always correct.
However, the right child(ren) of the left child of `n` could still be
at least the key.
Also added some tests which produced the wrong results before this.
2022-02-10 14:09:39 +00:00
Lenny Maiorani
e5d178528d
AK: Change static base36 character map to function-local constexpr
...
Static variables consume memory and can be subject to less
optimization. This variable is only used in 1 place and can be moved
into the function and make it non-static.
2022-02-10 10:22:54 +00:00
Ali Mohammad Pur
e7dea10381
AK: Add RBTree::find_smallest_above_iterator(Key)
2022-02-09 20:57:41 +00:00
Ali Mohammad Pur
cb7becb067
LibTLS+RequestServer: Add an option to dump TLS keys to a log file
...
This file allows us to decrypt TLS messages in wireshark, which can help
immensely in debugging network stuff :^)
2022-02-09 21:23:25 +01:00
Lenny Maiorani
138d54e595
AK+Kernel: Alphabetize debug macros
...
This is not ASCII-betical because `_` comes after all the uppercase
characters. Treating `_` as a ` ` (space character), these lists are
now alphabetical.
2022-02-09 17:59:19 +00:00
Hendiadyoin1
fbb798f98c
AK: Move integral log2 and exp to IntegerMath.h
2022-02-06 17:52:33 +00:00
Hendiadyoin1
9ba9691d19
AK: Use integral power for FixedPoint formatting
...
This removes an ifdef for the Kernel
2022-02-06 17:52:33 +00:00
Hendiadyoin1
581c23dc55
AK: Introduce IntegralMath.h starting with pow<I>
2022-02-06 17:52:33 +00:00
Andreas Kling
5dd4b3eaaa
LibWeb: Put ResolvedCSSStyleDeclaration debug spam behind a macro
...
Blowing up the debug console with a fajillion FIXME's whenever you
navigate in the web inspector is no fun.
2022-02-06 16:22:58 +01:00
Ali Mohammad Pur
9cf1c382df
AK: Replace 'consteval' with 'constexpr' in some Variant helpers
...
CLion and/or clangd didn't like the consteval and highlighted visit() as
an error, just replace it with constexpr as it makes no difference here.
2022-02-06 13:10:10 +01:00
Liav A
54845c4bf2
AK: Remove commented-out code from Bitmap container
...
Instead, add a note to explain that there's a const variant of data()
method in the parent BitmapView class.
2022-02-05 18:14:12 +00:00
Idan Horowitz
de7b5279cb
AK: Make Vector::data() ALWAYS_INLINE
...
This was showing up in profiles of Browser, and it really shouldn't be.
2022-02-05 16:48:14 +01:00
Idan Horowitz
18b98f8c28
AK: Convert the try_make<T> factory function to use ErrorOr
...
This allows more ergonomic memory allocation failure related error
checking using the TRY macro.
2022-02-03 23:33:20 +01:00
Idan Horowitz
ba0a2a3e2f
AK: Hide the infallible make<T> factory function from the Kernel
...
This function has no users, nor should it ever be used in the kernel,
as all allocation failures in the Kernel should be explicitly checked.
2022-02-03 23:33:20 +01:00
Idan Horowitz
7933a9b6c8
AK: Stop using the make<T> factory function in Trie
...
This function is infallible, and so we would like to exclude it from
the Kernel, which includes this header.
2022-02-03 23:33:20 +01:00
Idan Horowitz
a65bbbdb71
Kernel: Convert try_make_ref_counted to use ErrorOr
...
This allows more ergonomic memory allocation failure related error
checking using the TRY macro.
2022-02-03 23:33:20 +01:00
Idan Horowitz
be4c144524
AK: Support formatting Vectors with any inline_capacity
...
The default Vector type has its inline capacity set to 0, which means
any Vector with non-zero inline capacity was unformattable.
2022-02-03 23:33:20 +01:00
Andreas Kling
e86ab57078
AK+Kernel+LibSanitizer: Store "ubsan-is-deadly" flag as Atomic<bool>
2022-02-03 16:11:26 +01:00
Idan Horowitz
44e8c05c67
AK: Add a Utf16View::code_unit_offset_of(Utf16CodePointIterator) helper
...
This helper can be used to used to retrieve the code unit offset of an
active Utf16CodePointIterator efficiently.
2022-01-31 21:05:04 +02:00
Timothy Flynn
6efbafa6e0
Everywhere: Update copyrights with my new serenityos.org e-mail :^)
2022-01-31 18:23:22 +00:00
Timothy Flynn
94a346c9b9
AK: Add is_ascii_[binary,octal]_digit to CharacterTypes
2022-01-31 17:50:54 +00:00
Andreas Kling
51e5cc4e13
AK: Remove thread safety gunk from userspace WeakPtr
...
The implicit thread safety stuff is only needed by the kernel version
of WeakPtr, as userspace already makes no guarantees about this.
2022-01-31 16:19:23 +01:00
Daniel Bertalan
8473f6caee
AK+Tests: Make null strings compare less than non-null strings
...
This behavior regressed in ca58c71faa
.
Fixes #12213
2022-01-30 17:23:02 +00:00
Daniel Bertalan
1a4aad9b7e
AK: Implement String's comparison operators in terms of StringView's
2022-01-29 23:08:27 +01:00
Daniel Bertalan
5b3ba2d9ad
AK: Implement FlyString's comparison operators in terms of StringView's
2022-01-29 23:08:27 +01:00
Daniel Bertalan
ca58c71faa
AK: Implement all comparison operators for StringView
2022-01-29 23:08:27 +01:00
Idan Horowitz
9b0d90a71d
AK: Support using custom comparison operations for hash compatible keys
2022-01-29 23:01:23 +02:00
Lenny Maiorani
b0a54518d8
Everywhere: Remove redundant inline keyword
...
`constexpr` implies `inline` so when both are used it is redundant.
2022-01-29 21:45:17 +02:00
Pankaj Raghav
24c66b8442
AK: Fix log2 calculation for Integer
...
For a `N` bit integer X, the log2 calculation should be as follows:
(N - 1) - ctz(X)
2022-01-29 17:41:06 +02:00
Pankaj Raghav
61027e5303
AK: Add is_power_of_2 helper
2022-01-29 17:41:06 +02:00
Liav A
308e54bc19
AK+Kernel: Implement UUID mixed endianness support
...
This is being used by GUID partitions so the first three dash-delimited
fields of the GUID are stored in little endian order but the last two
fields are stored in big endian order, hence it's a representation which
is mixed.
2022-01-29 13:35:54 +02:00
kleines Filmröllchen
cfb8eeebe8
AK: Allow constructing a JsonArray from any array-like type
2022-01-28 23:40:25 +01:00
kleines Filmröllchen
2f631f7dc0
AK: Allow constructing a JsonValue from a StringView explicitly
...
The next commit will destroy overload detection otherwise, so let's add
this constructor. Currently, the same work is already done implicitly
through the implicit `String(StringView)` constructor.
2022-01-28 23:40:25 +01:00
kleines Filmröllchen
07977ad94c
AK: Introduce the ArrayLike concept
...
The ArrayLike type concept focuses on array-like data accesses. This
means the ability to randomly index, obtain size information, as well as
being able to expose the storage pointer. The last two already have the
standard APIs `size` and `data`, respectively.
The ArrayLike concept should always be fulfilled by Vector, FixedArray
and Array as the three main array-like types. C-style arrays themselves
of course can't fulfil ArrayLike (which could be considered ironic), but
as we don't use them much anyways this isn't a problem.
2022-01-28 23:40:25 +01:00
Ali Mohammad Pur
bf82d9b5d7
AK: Simplify Variant's explicit overload detection mechanism a bit
...
This also allows us to remove the max-64-visitors restriction, and so
removes that assertion.
2022-01-28 00:50:04 +03:30
Timothy Flynn
01395169dc
AK: Export the SameAs concept
2022-01-27 16:27:00 +00:00
Idan Horowitz
85437abfad
Kernel: Support try-inserting RedBlackTree entry values by reference
2022-01-26 22:05:34 +00:00
Idan Horowitz
6e38076b48
AK: Use x86 specific fast path in fast_u32{fill, copy} on x86_64
2022-01-26 01:16:43 +02:00
Idan Horowitz
67ce9e28a5
AK: Standardize the behaviour of GenericLexer::consume_until overloads
...
Before this commit all consume_until overloads aside from the Predicate
one would consume (and ignore) the stop char/string, while the
Predicate overload would not, in order to keep behaviour consistent,
the other overloads no longer consume the stop char/string as well.
2022-01-25 13:41:09 +03:30
Idan Horowitz
d49d2c7ec4
AK: Add a consume_until(StringView) overload to GenericLexer
...
This allows us to skip a strlen call.
2022-01-25 13:41:09 +03:30