Commit Graph

29 Commits

Author SHA1 Message Date
Ben Wiederhake
ee47c0275e Everywhere: Run spellcheck on all documentation 2023-05-07 01:05:09 +02:00
Linus Groh
d26aabff04 Everywhere: Run clang-format 2022-12-03 23:52:23 +00:00
Andreas Kling
ae3ffdd521 AK: Make it possible to not using AK classes into the global namespace
This patch adds the `USING_AK_GLOBALLY` macro which is enabled by
default, but can be overridden by build flags.

This is a step towards integrating Jakt and AK types.
2022-11-26 15:51:34 +01:00
Tim Schumacher
908d5a2853 AK: Expose RedBlackTree::find_smallest_not_below() 2022-04-21 13:16:56 +02:00
Idan Horowitz
086969277e Everywhere: Run clang-format 2022-04-01 21:24:45 +01: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
Ali Mohammad Pur
e7dea10381 AK: Add RBTree::find_smallest_above_iterator(Key) 2022-02-09 20:57:41 +00:00
Idan Horowitz
85437abfad Kernel: Support try-inserting RedBlackTree entry values by reference 2022-01-26 22:05:34 +00:00
Andreas Kling
a702b6ec42 AK: Remove unnecessary null checks in RedBlackTree 2022-01-12 14:52:47 +01:00
Andreas Kling
0f22ba5bf2 AK: Make RedBlackTree::try_insert() return ErrorOr<void> instead of bool 2021-11-18 21:11:30 +01:00
Andrew Kaster
e982253c33 AK: Avoid else after return in files commonly included by the Kernel 2021-11-14 22:52:35 +01:00
Brian Gianforcaro
c192c303d2 AK: Use default constructor/destructor instead of declaring an empty one
Default implementations allow for more optimizations.
See: https://pvs-studio.com/en/docs/warnings/v832/
2021-09-16 17:17:13 +02:00
Ali Mohammad Pur
913382734c AK: Allow RBTree::find_largest_not_above_iterator() to fail
Previously this function would've crashed if the key failed to match any
entry.
2021-09-13 14:38:53 +04:30
Idan Horowitz
cb9720baab AK: Set IntrusiveRBTree Node key on insertion instead of construction
This makes the API look much nicer.
2021-09-08 19:17:07 +03:00
Andreas Kling
a1d7ebf85a Kernel: Rename Kernel/VM/ to Kernel/Memory/
This directory isn't just about virtual memory, it's about all kinds
of memory management.
2021-08-06 14:05:58 +02:00
Brian Gianforcaro
6059d69249 AK: Mark RedBlackTree functions as [[nodiscard]] 2021-07-17 13:02:09 +02:00
Brian Gianforcaro
deda32628a AK: Mark RedBlackTree as final 2021-07-17 13:02:09 +02:00
Brian Gianforcaro
86b02a678c AK: Mark RedBlackTree find APIs as [[nodiscard]] 2021-07-17 13:02:09 +02:00
Andreas Kling
980f409003 AK: Allow getting the key from a RedBlackTree iterator 2021-07-15 01:48:10 +02:00
Andreas Kling
4ff35c23d3 AK: Make RedBlackTree non-copyable and non-movable 2021-07-15 01:48:09 +02:00
Idan Horowitz
e94dfb7355 AK: Expose RedBlackTree allocation failures via try_insert
This should help with using the RedBlackTree in a more OOM-safe way in
the kernel.
2021-07-15 00:49:41 +02:00
Itamar
d26f4f9e8c AK: Add RedBlackTree::find_largest_not_above_iterator
It's a version of find_largest_not_above that returns an iterator.
2021-06-19 14:51:18 +02:00
Idan Horowitz
f90c224fc5 Revert "AK: Remove virtual destructors from non-virtual classes"
This reverts commit 4378d36f67.
2021-04-23 10:26:14 +02:00
Lenny Maiorani
4378d36f67 AK: Remove virtual destructors from non-virtual classes
Problem:
- Some classes have `virtual` destructors despite not having any
  virtual functions. This causes the classes to have a v-table and
  perform extra jumps at destruction time when there is no need.

Solution:
- Remove `virtual` keyword from destructors where there are no other
  virtual functions.
- Remove the destructor completely when the default destructor can be
  used.
2021-04-23 08:28:25 +02:00
Idan Horowitz
1c512a702a AK+Userland: Use idan.horowitz@serenityos.org for my copyright headers 2021-04-22 22:42:38 +02:00
Brian Gianforcaro
1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
Linus Groh
2b0c361d04 Everywhere: Fix a bunch of typos 2021-04-18 10:30:03 +02:00
Idan Horowitz
e962254eb2 AK: Implement RedBlackTree container
This container is based on a balanced binary search tree, and as such
allows for O(logn) worst-case insertion, removal, and search, as well
as O(n) sorted iteration.
2021-04-12 18:03:44 +02:00