Commit graph

1423 commits

Author SHA1 Message Date
AnotherTest ec4980e875 AK: Ensure dual_pivot_quick_sort does not copy the pivots
Also add a test that would fail to compile if quick_sort tries to copy
anything :P
2020-12-10 11:02:02 +01:00
asynts 5b104eedaf AK: Fix offset calculation error in DuplexMemoryStream::write. 2020-12-09 21:17:24 +01:00
asynts ce15c9a04c AK: Fix unsigned integer underflow in DuplexMemoryStream::write. 2020-12-09 21:17:24 +01:00
asynts 78eff163ea AK: Add String::substring_view(size_t). 2020-12-09 21:05:06 +01:00
AnotherTest 3c41487db7 AK: Fix reading across chunks in DuplexMemoryStream 2020-12-08 23:34:38 +01:00
AnotherTest 602d2ff856 AK: Implement DuplexMemoryStream::offset_of() in terms of memmem()
This fixes the FIXME about missing matches that go across chunk
boundaries.
2020-12-08 23:34:38 +01:00
AnotherTest 036b39cdfd AK: Implement memmem() for iterator haystacks
This uses the KMP algorithm to implement the search.
Also replaces the slow route of the normal memmem() with KMP, which
should be fairly faster (O(n + m) as opposed to O(n * m)) :^)
2020-12-08 23:34:38 +01:00
AnotherTest c85eaadb48 AK: Forward declare Nonnull{Own,Ref}PtrVector 2020-12-08 23:34:38 +01:00
Sahan Fernando d50934823a AK: Add header for SIMD vectorized types 2020-12-08 09:39:43 +01:00
Linus Groh 2313e58393 AK: Make Formatter<StringView> not choke on Mode::Character
Formatter<char> internally uses Formatter<StringView> when in
Mode::Character, but that would only accept Mode::{Default,String} and
ASSERT_NOT_REACHED() otherwise, causing String::formatted("{:c}", 'a')
to crash
2020-12-06 18:52:52 +01:00
Andrew Kaster 6919639190 AK: Add test for the will_be_destroyed and one_ref_left magic functions
Fixes a regression introduced by 5c1b3ce. The commit description there
asserts that the changes allow calling will_be_destroyed and
one_ref_left, which are not required to be const qualified. The
implementation in fact does require the methods to be const qualified,
because we forgot to add the const_cast inside the decltypes :^)
2020-12-06 15:49:33 +01:00
Linus Groh 4dcd23c2be AK: Pull Is{Integral,FloatingPoint} into the global namespace 2020-12-05 23:52:17 +01:00
Tom c6230b746d AK: Add insert_before/insert_after to InlineLinkedList 2020-12-02 13:02:04 +01:00
Linus Groh ba020a5907 AK: Fix logic error in urldecode() percent-decoding
We also need to append the raw consumed value if *either* of the two
characters after the % isn't a hex digit, not only if *both* aren't.

Fixes #4257.
2020-11-30 11:35:01 +01:00
AnotherTest c6ca8534a6 AK: Export ShouldChomp::NoChomp too
It's much more elegant to say 'should_chomp ? Chomp : NoChomp' than to
say 'if (should_chomp) ...(..., Chomp) else ...(...)'.
2020-11-29 20:32:10 +01:00
devashish 0b252c31b2 AK: Add missing GenericTraits<u8>
This enables us to use keys of type u8 in HashMaps.
2020-11-29 16:22:04 +01:00
DavidKorczynski ff8ac60184
Lagom: Various fixes to make Lagom run on OSS-Fuzz (#4176) 2020-11-27 23:57:02 +01:00
Andreas Kling 2f491e7769 AK: Always inline RefPtr::operator bool() and RefPtr::is_null() 2020-11-25 21:26:58 +01:00
Linus Groh 5dcd1c2709 AK: Don't return empty StringImpl from create() when char* starts with \0
When creating a StringImpl for a C string that starts with a null-byte,
we would ignore the explicitly given length and return the empty
StringImpl - presumably to check for "\0", but this leads to false
positives ("\0foo") so let's only care about the length.
2020-11-25 20:17:25 +01:00
Andreas Kling 54ade31d84 AK: Add some inline capacity to StringBuilder
This patch adds a 128-byte inline buffer that we use before switching
to using a dynamically growing ByteBuffer.

This allows us to avoid heap allocations in many cases, and totally
incidentally also speeds up @nico's favorite test, "disasm /bin/id"
more than 2x. :^)
2020-11-24 22:06:51 +01:00
Andreas Kling c33d71c5ff AK: Add IntrusiveList::take_last() 2020-11-24 16:37:55 +01:00
Sergey Bugaev fa2e3e2be4 LibIPC: Prepend each message with its size
This makes it much simpler to determine when we've read a complete message, and
will make it possible to integrate recvfd() in the future commit.
2020-11-23 18:37:40 +01:00
Sergey Bugaev d62346c0b1 AK: Add Vector::prepend() overload for multiple items
Much like with Vector::append(), you may want to append multiple items in one
go. It's actually more important to do this for prepending, because you don't
want to copy the rest of items further each time.
2020-11-23 18:37:40 +01:00
Andreas Kling dd43cf2657 AK: Use ALWAYS_INLINE all over NonnullPtrVector
I saw NonnullOwnPtrVector::at() in a profile and that was silly, as we
should definitely be inlining it.
2020-11-23 14:08:50 +01:00
Luke 819f099a8e AK: Add first_matching and last_matching to Vector
first_matching returns the first item in the vector that matches
the given condition.

last_matching returns the last item in the vector that matches
the given condition.
2020-11-22 18:20:56 +01:00
BenJilks 29ada654b1 AK: Fix base64 decoding '/'
When creating the lookup table, it wouldn't add the last
character
2020-11-22 16:07:00 +01:00
Lenny Maiorani 7d8a9bdb1e AK: Cleanup missing includes and #ifdef evaluation
Problem:
- Several files have missing includes. This results in complaints from
  `clang-tidy`.
- `#ifdef` is followed by `#elif <value>` which evaluates to `0`.

Solution:
- Add missing includes.
- Change to `#elif defined(<value>)`.
2020-11-22 11:35:53 +01:00
Lenny Maiorani 840c3b501d NeverDestroyed: Add tests
Problem:
- It is difficult to refactor because there are no tests to bind the
functionality.
- Arguments are not forwarded correctly to the constructor.

Solution:
- Add tests.
- Change constructor to take forwarding references.
2020-11-22 10:54:33 +01:00
Lenny Maiorani 178190ab52 MACAddress: Use all_of to implement is_zero
Problem:
- `is_zero()` is implemented by checking each value in the array by
  hand. This is error-prone and less expressive than using an
  algorithm.

Solution:
- Implement `is_zero()` in terms of `all_of`.
2020-11-21 19:25:14 +01:00
Lenny Maiorani 6e7e16a7ed AK: Implement generic all_of algorithm
Problem:
- Raw loops are often written to validate that all values in a
  container meet a predicate, but raw loops are not as expressive as
  functions implementing well-named algorithms and are error-prone.

Solution:
- Implement a very generic form of `all_of`.
2020-11-21 19:25:14 +01:00
Lenny Maiorani bdf3baa8ac MACAddress: AK::Array as member variable instead of C-array
Problem:
- C-style arrays do not automatically provide bounds checking and are
  less type safe overall.
- `__builtin_memcmp` is not a constant expression in the current gcc.

Solution:
- Change private m_data to be AK::Array.
- Eliminate constructor from C-style array.
- Change users of the C-style array constructor to use the default
  constructor.
- Change `operator==()` to be a hand-written comparison loop and let
  the optimizer figure out to use `memcmp`.
2020-11-20 21:18:14 +01:00
Lenny Maiorani 964d2e0dd0 MACAddress: constexpr support
Problem:
- `MACAddress` class is not usable in a compile-time context.
- `__builtin_memcpy` is not constexpr in gcc.

Solution:
- Decorate functions with `constexpr` keyword.
- Use default constructors and destructors.
- Change `__builtin_memcpy` to a hand-written `for` loop and let the
  compiler's optimizer take care of it.
- Add tests to ensure compile-time capabilities.
2020-11-19 14:03:47 +01:00
AnotherTest 4c343c5f26 AK: Fix OOB access in DuplexMemoryStream::offset_of()
This fixes an OOB access when the last read/written chunk is empty (as we _just_
started on a new chunk).
Also adds a test case to TestMemoryStream.
Found via human fuzzing in the shell:
```sh
for $(cat /dev/urandom) {
    clear
    match $it {
        ?* as (x) {
            echo $x
            sleep 1
        }
    }
}
```
would assert at some point.
2020-11-17 17:07:39 +01:00
Linus Groh d6a4c0c79e AK: Trim whitespace in StringUtils::convert_to_{int,uint,uint_from_hex}()
Personally I found this unintuitive at first, but it is in line with
strtol(), Python's int() or JavaScript's parseInt(), so I guess it makes
sense.

Fixes #4097.
2020-11-17 09:48:35 +01:00
Lenny Maiorani fd97f23cef MACAddress: Unit testing for basic functionality
Problem:
- There are no unit tests for `MACAddress` class. This makes it
  difficult to refactor and ensure the same behavior.
- `m_data` private member variable is uninitialized leading to undefined
  behavior of `is_zero()`.

Solution:
- Add unit tests to cover basic functionality.
- Initialize `m_data`.
2020-11-17 09:47:50 +01:00
Lenny Maiorani 2a06b026ef Vector: C++20 equality operators
Problem:
- C++20 changes the way equality operators are generated. This results
  in overload ambiguity as reported by clang.

Solution:
- Remove `AK::Vector::operator!=` because it will be automatically
  generated in terms of `AK::Vector::operator==`.
- Change `AK::Vector::operator==` to be a function template so that
  overload resolution is not confused about `a == b` vs `b == a`.
- Add tests to ensure the behavior works.

Notes:
- There is more info available at
  https://brevzin.github.io/c++/2019/07/28/comparisons-cpp20/ for
  deeper discussion about overload resolution, operator rewriting, and
  generated functions.
2020-11-16 10:06:23 +01:00
Andreas Kling adabcf24ec Everywhere: Add missing <AK/ByteBuffer.h> includes
All of these files were getting ByteBuffer.h from someone else and then
using it. Let's include it explicitly.
2020-11-15 13:11:21 +01:00
Andreas Kling a5982f8605 AK: Mark SimpleIterator::operator*() as ALWAYS_INLINE
This gives the compiler enough information to optimize index validation
when using range-for to iterate over a Vector, drastically reducing the
cost of such loops.
2020-11-14 17:20:17 +01:00
Linus Groh d3ee3fc68a AK: Fix StringUtils::contains() case insensitive search
It would incorrectly return false if needle was at the end the string.
2020-11-14 10:11:26 +01:00
Andreas Kling cfc5d146d3 AK: Fix inverted condition in unsigned LEB128 decode 2020-11-13 11:05:46 +01:00
Lenny Maiorani f5ced347e6 AK: Prefer using instead of typedef
Problem:
- `typedef` is a keyword which comes from C and carries with it old
  syntax that is hard to read.
- Creating type aliases with the `using` keyword allows for easier
  future maintenance because it supports template syntax.
- There is inconsistent use of `typedef` vs `using`.

Solution:
- Use `clang-tidy`'s checker called `modernize-use-using` to update
  the syntax to use the newer syntax.
- Remove unused functions to make `clang-tidy` happy.
- This results in consistency within the codebase.
2020-11-12 10:19:04 +01:00
Lenny Maiorani 5570b16f6f RefPtrTraits: struct/class mismatch in forward declaration
Problem:
- Building with clang is broken because of the `struct` vs `class`
  mismatch between the definition and declaration.

Solution:
- Change `class` to `struct` in the forward declaration.
2020-11-11 20:25:29 +01:00
Lenny Maiorani 72d019f4a4 IPv4Address: constexpr support
Problem:
- IPv4Address class cannot be used in a compile-time context.
- A union is used by initializing one of the members and reading the
  non-active member. This is undefined behavior and not permitted in a
  `constexpr` context.

Solution:
- Eliminate undefined behavior by changing to a simple `u32` for
  storage instead of the union and performing mask/shift calculations
  for obtaining the individual octets.
- Decorate functions with `constexpr` where possible. Currently string
  formatting and optionals are not `constexpr`-capable so functions
  using those are left out.
- Modify tests to validate functionality in a `constexpr` context in
  addition to the run-time tests already being run. This ensures that
  functionality is the same in both contexts.
2020-11-11 12:18:25 +01:00
Tom 75f61fe3d9 AK: Make RefPtr, NonnullRefPtr, WeakPtr thread safe
This makes most operations thread safe, especially so that they
can safely be used in the Kernel. This includes obtaining a strong
reference from a weak reference, which now requires an explicit
call to WeakPtr::strong_ref(). Another major change is that
Weakable::make_weak_ref() may require the explicit target type.
Previously we used reinterpret_cast in WeakPtr, assuming that it
can be properly converted. But WeakPtr does not necessarily have
the knowledge to be able to do this. Instead, we now ask the class
itself to deliver a WeakPtr to the type that we want.

Also, WeakLink is no longer specific to a target type. The reason
for this is that we want to be able to safely convert e.g. WeakPtr<T>
to WeakPtr<U>, and before this we just reinterpret_cast the internal
WeakLink<T> to WeakLink<U>, which is a bold assumption that it would
actually produce the correct code. Instead, WeakLink now operates
on just a raw pointer and we only make those constructors/operators
available if we can verify that it can be safely cast.

In order to guarantee thread safety, we now use the least significant
bit in the pointer for locking purposes. This also means that only
properly aligned pointers can be used.
2020-11-10 19:11:52 +01:00
Tom 3c1ef744f6 AK: Add RefPtrTraits to allow implementing custom null pointers
This adds the ability to implement custom null states that allow
storing state in null pointers.
2020-11-10 19:11:52 +01:00
Lenny Maiorani c5b26a0df8 IPv4Address: Unit tests
Problem:
- There is no direct unit testing of the IPv4Address functionality
  which makes refactoring difficult.

Solution:
- Add unit tests to cover the current functionality of
  IPv4Address. This will allow future refactorings with confidence.
2020-11-10 09:30:39 +01:00
asynts 32957745fb AK: Add formatters for floating point numbers. 2020-11-09 16:21:29 +01:00
asynts 3b3edbc4d2 AK: Rename new_out to out and new_warn to warn. 2020-11-09 16:21:29 +01:00
asynts 74438e6fdc AK: Remove out() and warn(). 2020-11-09 16:21:29 +01:00
Andreas Kling 81b7c072ed AK: Use reference algorithms for LEB128 parsing
This fixes a bug in signed LEB128 parsing (sign extension stage)
which would sometimes cause debug info to look very strange.
2020-11-08 22:38:27 +01:00
Linus Groh 9c3ead8f91 LibJS+AK: Move cross-platform stack bounds code from JS::Heap to AK::StackInfo
This will be useful for other things than the Heap, maybe even outside
of LibJS.
2020-11-08 16:51:54 +01:00
Nico Weber e673abb93f AK: Remove duplicate begin()/end() methods
begin()/end() returning a ConstItertor already exist further up
in this file. Nothing uses these redundant versions, and they are not
callable.
2020-11-07 18:28:35 +01:00
Andreas Kling e9403e2b03 AK: printf was not accounting for plus sign with "%+d"
We have to include the plus sign in the number of characters written,
otherwise sprintf() will put the null terminator too early.
2020-11-05 11:04:10 +01:00
Andreas Kling 575c483310 AK: Always include <new> from compiler before our operators new
We had competing inline definitions of the placement operators new.
Avoid this by having <AK/kmalloc.h> pull in <new> from the compiler
and always using their definitions instead.

I feel like there must be an elegant solution to this whole situation
with the operators, but I'm not sure what it is.
2020-11-05 09:59:30 +01:00
Brendan Coles 3e0e84dcd1 AK::URL: Check if URL requires a port set to be considered a valid URL
`AK::URL` will now check if the URL requires a port to be set using
`AK::URL.protocol_requires_port(protocol)`.

If the URL does not specify a port, and no default port for the URL
protocol is found with `AK::URL.default_port_for_protocol(protocol)`,
the URL is considered to be invalid.
2020-11-04 19:34:00 +01:00
AnotherTest 060ddd2a7a AK: Really disallow making OwnPtrs from refcounted types
This looks at three things:
- if the type has a typedef `AllowOwnPtr', respect that
- if not, disallow construction if both of `ref()' and `unref()' are
  present.
Note that in the second case, if a type only defines `ref()' or only
defines `unref()', an OwnPtr can be created, as a RefPtr of that type
would be ill-formed.

Also marks a `Performance' to explicitly allow OwnPtrs.
2020-11-03 19:14:34 +01:00
Andreas Kling 5e164052f6 AK+Kernel: Escape JSON keys & values
Grab the escaping logic from JSON string value serialization and use
it for serializing all keys and values.

Fixes #3917.
2020-11-02 12:56:36 +01:00
AnotherTest 0801b1fada AK: Make String::matches() capable of reporting match positions too
Also, rewrite StringUtils::match(), because the old implementation was
fairly broken, e.g. "acdcxb" would *not* match "a*?b".
2020-10-29 11:53:01 +01:00
AnotherTest f0e59f2dac AK: Add a `is_one_of()' to StringView
This copies the similar API from String.
2020-10-29 11:53:01 +01:00
asynts 607931268e CMake: Use CONFIGURE_DEPENDS in existing globs. 2020-10-29 11:52:47 +01:00
Linus Groh 1daa5158eb AK: Add GenericLexer::retreat()
This allows going back one character at a time, and then re-consume
previously consumed chars.
The code I need this for looks something like this:

    ASSERT(lexer.consume_specific('\\'));
    if (lexer.next_is("foo"))
        ...
    lexer.retreat();
    lexer.consume_escaped_character();  // This expects lexer.peek() == '\\'
2020-10-29 11:52:31 +01:00
asynts 1319ad476d AK: Deprecate warn(). 2020-10-25 18:52:51 +01:00
asynts 1254cbbd0b AK: Eradicate calls to warn(). 2020-10-25 18:52:51 +01:00
asynts 0ab3488b60 AK: Remove a really slow unit test. 2020-10-25 18:52:51 +01:00
asynts aa115fe27b AK: Add [[deprecated]] to out(). 2020-10-24 12:56:25 +02:00
asynts 61e73b1a7b AK: Introduce SourceGenerator::fork().
Previously, I abused the copy constructor, this is a lot better.
2020-10-24 12:56:25 +02:00
AnotherTest 27040e65eb AK: Add `GenericLexer::consume_escaped_character()'
...and use it in `consume_and_unescape_string()'.
2020-10-22 23:49:51 +02:00
Tom 25e7225782 AK: Enhance String::contains to allow case-insensitive searches 2020-10-22 15:23:45 +02:00
Tom 6413acd78c AK: Make Utf8View and Utf32View more consistent
This enables use of these classes in templated code.
2020-10-22 15:23:45 +02:00
Lenny Maiorani 91ea6057d6 TestArray: constexpr_sum using span
Problem:
- `constexpr_sum` is implemented using `Array` which means the
  function needs to be a function template so that the size can be
  deduced.

Solution:
- Change the `Array` function argument to a `Span` since `Span` now is
  `constexpr`.
2020-10-21 19:42:46 +02:00
Lenny Maiorani 18a40587ea HashFunctions: constexpr capability
Problem:
- Hash functions can be `constexpr`, but are not.

Solution:
- Change `inline` keyword to `constexpr`.
- Add `static_assert` tests to ensure the hash functions work in a
  `constexpr` context.
2020-10-21 19:42:12 +02:00
Lenny Maiorani 070fc69562 TestHashFunctions: Tests to bind hash functionality
Problem:
- The hash functions have no associated tests, so there is nothing
  binding their behavior.

Solution:
- Bind the hash function behavior by adding tests.
- Use the existing behavior as "correct".
2020-10-21 19:42:12 +02:00
Lenny Maiorani d1fe6a0b53
Everywhere: Redundant inline specifier on constexpr functions (#3807)
Problem:
- `constexpr` functions are decorated with the `inline` specifier
  keyword. This is redundant because `constexpr` functions are
  implicitly `inline`.
- [dcl.constexpr], §7.1.5/2 in the C++11 standard): "constexpr
  functions and constexpr constructors are implicitly inline (7.1.2)".

Solution:
- Remove the redundant `inline` keyword.
2020-10-20 18:08:13 +02:00
Lenny Maiorani a40abd6ce3 Checked: constexpr support
Problem:
- `Checked` is not `constexpr`-aware.

Solution:
- Decorate member functions with `constexpr` keyword.
- Add tests to ensure the functionality where possible.
2020-10-20 16:31:24 +02:00
Lenny Maiorani bd99083436 Checked: Use default compiler-generated functions
Problem:
- Compiler-generated functions are being defined which results in
  extra code to maintain.

Solution:
- Switch to compiler-generated default functions for default
  construction, copy assignment, move assignment, copy construction
  and move construction.
2020-10-20 16:31:24 +02:00
Laurent Cimon b4790010a8 Build: Modify various parts to allow the build to succeed on FreeBSD 2020-10-20 14:40:47 +02:00
Dano Perniš 3efd4c105f AK: Reduce memory writes in HashTable destructor 2020-10-18 14:44:23 +02:00
Dano Perniš d30c559774 AK: Implement HashTable assignment in terms of swap 2020-10-18 14:44:23 +02:00
Dano Perniš 7f3f63dd92 AK: Provide swap() for HashTable 2020-10-18 14:44:23 +02:00
Lenny Maiorani 919fc7a814 CircularQueue: Ensure constructor does not construct any values
Problem:
- There is no test which guarantees the CircularQueue does not
  construct any objects of the value type. The goal is to have
  uninitialized memory which can be used.

Solution:
- Add a test requiring that the constructor of the value type is never
  called.
2020-10-17 23:21:00 +02:00
asynts 235622dc7f AK: Add formatters for NonnullOwnPtr and WeakPtr. 2020-10-17 23:20:31 +02:00
asynts 0508fdbbcd AK+Format: Add outln(FILE*, ...) overload.
This commit also removes a few functions like raw_out and vwarn. If we
want to write raw output, we can do this as follows:

    out("{}", "Hello, World!");

The vout stuff isn't really public API anyways, so no need for another
vwarn.
2020-10-17 23:20:31 +02:00
Lenny Maiorani a274a8e5a0 BinarySearch: constexpr support
Problem:
- It is not possible to perform a binary search at compile-time
  because `binary_search` is not `constexpr`-aware.

Solution:
- Add `constexpr` support.
2020-10-17 23:19:37 +02:00
Nico Weber 5f50af3b4f ntpquery: Don't leak local time, and check origin time in reply
This implements the transmit time suggestion in (abandoned?)
draft-ietf-ntp-data-minimization. (The other suggestions were already
implemented as far as I can tell.)
2020-10-17 23:19:14 +02:00
Lenny Maiorani 4c759ff751 Span: constexpr support
Problem:
- `Span` is not `constexpr` aware.

Solution:
- Add `constexpr` support for all parts that do not require
  `reinterpret_cast`.
- Modify tests which use the `constexpr` functions.
2020-10-16 17:06:47 +02:00
Andreas Kling 7ad8bb5be6 AK: Tune HashTable load factor
Double the capacity when used+deleted buckets crosses 60% of capacity.
This appears to be a sweet spot for performance based on some ad-hoc
testing with test-js. :^)
2020-10-16 08:47:10 +02:00
Andreas Kling 544f2f3c96 AK: Add some more checks to the HashMap test 2020-10-16 00:02:23 +02:00
Andreas Kling 4e50079f36 AK: Redesign HashTable to use closed hashing
Instead of each hash bucket being a SinglyLinkedList, switch to using
closed hashing (open addressing). Buckets are chained together via
double hashing (hashing the hash until we find an unused bucket.)

This greatly reduces malloc traffic, since each added element no longer
allocates a new linked list node.

Appears performance neutral on test-js. Can definitely be tuned and
could use proper management of load factor, etc.
2020-10-15 23:49:53 +02:00
Andreas Kling 76aab2fe8d AK: Improve HashMap tests a little bit 2020-10-15 23:49:53 +02:00
asynts c1823d8a34 AK: Don't forward declare abort.
There is no portable way to forward declare abort because the libc
implementations disagree on the signature.

Originally, I added a __portable_abort function with a "portable"
signature which just called abort. But I really don't like it and just
including <stdlib.h> is simpler.

Note that the headers we include in <AK/TestSuite.h> are no longer
commutative now, we have to include <stdlib.h> before anything else.
2020-10-14 11:29:29 +02:00
Lenny Maiorani 2983215fb1 Base64: Pre-allocate size of input and output
Problem:
- Output of decode and encode grow as the decode and encode
  happen. This is inefficient because a large size will require many
  reallocations.
- `const` qualifiers are missing on variables which are not intended
  to change.

Solution:
- Since the size of the decoded or encoded message is known prior to
  starting, calculate the size and set the output to that size
  immediately. All appends will not incur the reallocation overhead.
- Add `const` qualifiers to show intent.
2020-10-13 23:59:46 +02:00
Paul Scharnofske d94f674bbb
Use new format functions in remaining DevTools. (#3755)
* AK: Add formatter for JsonValue.

* Inspector: Use new format functions.

* Profiler: Use new format functions.

* UserspaceEmulator: Use new format functions.
2020-10-13 18:34:27 +02:00
Lenny Maiorani 626bb1be9c Base64: constexpr initialization of alphabet and lookup table
Problem:
- The Base64 alphabet and lookup table are initialized at
  run-time. This results in an initial start-up cost as well as a
  boolean evaluation and branch every time the function is called.

Solution:
- Provide `constexpr` functions which initialize the alphabet and
  lookup table at compile-time. These can be called and assigned to a
  `constexpr` variable so that there is no run-time cost associated
  with the initialization or lookup.
2020-10-13 18:33:21 +02:00
asynts b99cebf63a AK: Add SourceGenerator class. 2020-10-12 19:40:49 +02:00
asynts cf6980848b AK: Add formatter for LexcialPath. 2020-10-09 20:52:17 +02:00
asynts 7ae530fbc7 AK+Format: Remove new_dbg(dbg) and raw_dbg.
We are adding the process name as prefix and a newline as suffix to any
message written to debug. Thus, the following doesn't make any sense:

    for (u8 byte : bytes)
        dbg("{:02x} ", byte);
    dbgln();

Which function call would put the prefix? This doesn't make any sense,
thus these functions must go.

The example above could be converted to:

    StringBuilder builder;
    for (u8 byte : bytes)
        builder.appendff("{:02x} ", byte);
    dbgln("{}", builder.build());
2020-10-09 20:52:17 +02:00
Lenny Maiorani 151b8b5984 Endian: constexpr constructors and conversion operators
Problem:
- Constructors and conversion operators are not `constexpr`,
  but they can be.
- `constexpr` is needed here so that other classes can add `constexpr`
  evaluation.

Solution:
- Add the `constexpr` keyword to the constructors and
  conversion operators.
- Add `static_assert` tests which ensure the capability works.
2020-10-08 23:28:54 +02:00
Matthew Olsson 67f2301150 AK: Make StringView hashable 2020-10-08 23:27:16 +02:00
asynts 1d96d5eea4 AK: Use new format functions. 2020-10-08 09:59:55 +02:00
asynts d781f3f6b5 AK: Add formatter for StringImpl. 2020-10-08 09:59:55 +02:00
asynts d546d31a53 AK+Format: Make it possible to format characters as integers. 2020-10-08 09:59:55 +02:00
asynts 2217d6b560 AK+Format: Add SFINAE wrapper 'FormatIfSupported'. 2020-10-08 09:59:55 +02:00
asynts afef05ece2 AK+Format: Add overloads with const char* for outln, warnln and dbgln.
This makes it possible to forward declare 'warnln' in TestSuite.h.
2020-10-08 09:59:55 +02:00
asynts 15c3feb351 AK+Format: Add overloads without arguments to outln, warnln and dbgln. 2020-10-08 09:59:55 +02:00
asynts b94cb02a7f AK+Format: Use pointer mode for pointers by default. 2020-10-08 09:59:55 +02:00
Lenny Maiorani 9ae78c50fd VariadicFormatParams: Use initialized data to create parent class
Problem:
- m_data is being passed to the constructor of the parent class before
  it is initialized. This is not really a problem because the compiler
  knows the location and it is only a span being constructed, but it
  triggers a warning in clang for use-before-init.

Solution:
- Initialize using a default constructed array and then overwrite it
  inside the constructor after the member is initialized.
2020-10-08 09:55:39 +02:00
Lenny Maiorani fcee80dd69 Formatter: Remove extraneous char definition
Formatter is specialized in the header file. The definition in the
implementation file is extraneous and has no effect. Simply removing
it so that there is no confusion.
2020-10-08 09:54:56 +02:00
Andreas Kling d3d3b25e1c AK: Make Vector::remove_first_matching() signal if anything was removed 2020-10-06 18:38:18 +02:00
Andreas Kling 3dbd5c98da AK: Use StringImpl::operator== in FlyString 2020-10-06 17:43:51 +02:00
asynts da9c995a8c IRCClient: Use new format functions. 2020-10-06 15:28:39 +02:00
asynts d2ca7ca017 AK+Format: Make it possible to format string literals as pointers.
String literals are just pointers to a constant character. It should be
possible to format them as such. (The default is to print them as
strings still.)
2020-10-06 15:28:39 +02:00
asynts 7c2cd81edb AK+Format: Exclude prefix from width calculation.
When we write the format specifier '{:#08x}' we are asking for eight
significant digits, zero padding and the prefix '0x'.

However, previously we got only six significant digits because the
prefix counted towards the width. (The number '8' here is the total
width and not the number of significant digits.)

Both fmtlib and printf shared this behaviour. However, I am introducing
a special case here because when we do zero padding we really only care
about the digits and not the width.

Notice that zero padding is a special case anyways, because zero padding
goes after the prefix as opposed to any other padding which goes before
it.
2020-10-06 15:28:39 +02:00
Tucker Polomik ad8284bac6 AK: check fractional string has_value() in JsonParser
Resolves #3670
2020-10-06 14:27:51 +02:00
Nico Weber cc765e14ca AK: Move StringImpl::operator== implementation into StringImpl 2020-10-05 17:35:27 +02:00
asynts 31feefff5e AK: Add formatter for NonnullRefPtr<T>. 2020-10-05 14:19:24 +02:00
AnotherTest b42c6ea281 LibIPC: Make IPC::encode() and ::decode() fail at compiletime when used
This would previously fail at runtime, and it would have zero indication
of what exactly went wrong.
Also adds `AK::DependentFalse<Ts...>', which is a...dependent false.
2020-10-04 23:12:28 +02:00
asynts 59e7ffa86d AK: Make the return type of dbgputstr consistent. 2020-10-04 19:18:32 +02:00
asynts d5ffb51a83 AK: Don't add newline for outf/dbgf/warnf.
In the future all (normal) output should be written by any of the
following functions:

    out    (currently called new_out)
    outln
    dbg    (currently called new_dbg)
    dbgln
    warn   (currently called new_warn)
    warnln

However, there are still a ton of uses of the old out/warn/dbg in the
code base so the new functions are called new_out/new_warn/new_dbg. I am
going to rename them as soon as all the other usages are gone (this
might take a while.)

I also added raw_out/raw_dbg/raw_warn which don't do any escaping,
this should be useful if no formatting is required and if the input
contains tons of curly braces. (I am not entirely sure if this function
will stay, but I am adding it for now.)
2020-10-04 17:04:55 +02:00
Andreas Kling f41b5a4535 AK: Add Formatter for FlyString :^) 2020-10-04 17:03:33 +02:00
asynts b23f66e151 AK: Add formatter for URL. 2020-10-04 14:23:25 +02:00
asynts aa283d235a AK: Add special formatter for char.
When we format a character we want to put the ascii value and not the
decimal value. The old behaviour can be obtained with '{:d}'.
2020-10-04 14:23:25 +02:00
asynts 1f90e4ab8d AK: Replace a write_or_error call with write.
Implicit conversions suck...
2020-10-03 20:16:26 +02:00
asynts b33921531d AK: Make Buffered<T> non-copyable. 2020-10-03 20:16:26 +02:00
asynts 9f00afd8cd AK: Add missing Bytes::slice call in Buffered<T>. 2020-10-03 17:33:14 +02:00
Linus Groh bcfc6f0c57 Everywhere: Fix more typos 2020-10-03 12:36:49 +02:00
asynts 6351a56d27 AK+Format: Do some housekeeping in the format implementation. 2020-10-02 20:48:19 +02:00
Tom 7399874479 AK: Add trivial structure validation to SharedBuffer
If we're sharing buffers, we only want to share trivial structures
as anything else could potentially share internal pointers, which
most likely is going to cause problems due to different address
spaces.

Fix the GUI::SystemTheme structure, which was not trivial, which
is now caught at compile time.

Fixes #3650
2020-10-02 15:38:07 +02:00
Tom bb92eab9ce AK: Add is_trivial and is_trivially_copyable 2020-10-02 15:38:07 +02:00
asynts fb7a94c959 AK: Add formatter for pointer types. 2020-10-02 13:44:42 +02:00
asynts ebafc5b4d2 AK: Add formatter for boolean values. 2020-10-02 13:44:42 +02:00
asynts 1175ecf1dd AK+Format: Add support for integer to character casts.
Now the following is possible:

    outf("{:c}", 75); // K
2020-09-29 16:14:58 +02:00
asynts f221a95a71 AK: Add NumericLimits specialization for char.
This is yet another bug because of the 'char'/'signed char'/'unsigned char' shit.
2020-09-29 16:14:58 +02:00
asynts 71b7ef0992 AK+Format: Support all format specifiers for strings.
The following is now possible:

    outf("{:.4}", "abcdef"); // abcd
    outf("{:*<8}", "abcdef"); // abcdef**
2020-09-29 16:14:58 +02:00
asynts 13ce24de13 AK+Format: Support default index in replacement field.
The following does now work:

    outf("{:0{}}", 1, 3);      // 001
2020-09-28 17:41:27 +02:00
asynts 574f49e4be AK+TestSuite: Don't assume that the test passed in output.
The problem with our test suite is that it can't detect if a test
failed. When a test fails we simply write 'FAIL ...' to stderr and move
on.

Previously, the test suite would list all tests as passing regardless
how many assertions failed. In the future it might be smart to implement
this properly but test suites for C++ are always hard to do nicely.
(Because C++ execution isn't meant to be embedded.)
2020-09-28 15:10:52 +02:00
asynts 56bfefabb6 AK+Format: Keep type information for integers in TypeErasedParameter.
It's now save to pass a signed integer as parameter and then use it as
replacement field (previously, this would just cast it to size_t which
would be bad.)
2020-09-28 10:53:16 +02:00
asynts 6a2f5f4522 AK+Format: Clean up format specifier parsing using GenericLexer.
Also adds support for replacement fields.
2020-09-28 10:53:16 +02:00
Benoît Lormeau f0f6b09acb AK: Remove the ctype adapters and use the actual ctype functions instead
This finally takes care of the kind-of excessive boilerplate code that were the
ctype adapters. On the other hand, I had to link `LibC/ctype.cpp` to the Kernel
(for `AK/JsonParser.cpp` and `AK/Format.cpp`). The previous commit actually makes
sense now: the `string.h` includes in `ctype.{h,cpp}` would require to link more LibC
stuff to the Kernel when it only needs the `_ctype_` array of `ctype.cpp`, and there
wasn't any string stuff used in ctype.
Instead of all this I could have put static derivatives of `is_any_of()` in the
concerned AK files, however that would have meant more boilerplate and workarounds;
so I went for the Kernel approach.
2020-09-27 21:15:25 +02:00
Benoit Lormeau e4da2875c5 AK: Use templates instead of Function for Conditions in the GenericLexer
Since commit 1ec59f28ce turns the ctype macros
into functions we can now feed them directly to a GenericLexer! This will lead to
removing the ctype adapters that were kind-of excessive boilerplate, but needed as
the Kernel doesn't compile with the LibC.
2020-09-27 21:15:25 +02:00
AnotherTest 5fbec2b003 AK: Move trim_whitespace() into StringUtils and add it to StringView
No behaviour change; also patches use of `String::TrimMode` in LibJS.
2020-09-27 21:14:18 +02:00
Tom 079486ed7e AK: Clear previous/next link in InlineLinkList::remove 2020-09-27 19:46:04 +02:00
asynts 01915a3027 AK+Format: Use the new format backend in the implementation. 2020-09-26 17:19:04 +02:00
asynts 2111fc5f63 AK+Format: Add new integer to string backend.
I put this into the <AK/PrintfImplementation.h> header in the hope that
it could be re-used by the printf implementation. That would not be
super trivial though, so I am not doing that now.
2020-09-26 17:19:04 +02:00
Benoit Lormeau 8f34b493e4 AK: Enhance GenericLexer's string consumption
The `consume_quoted_string()` can now take an escape character. This allows it
(for example) to capture a string's enclosing quotes. The escape character is
optional by default.

You can also consume and unescape a quoted string with the eponymous method
`consume_and_unescape_string()`. It takes an escape character as parameter
(backslash by default). It builds a String in which common escape sequences
get... unescaped :^) (e.g. \n, \r, \t...).
2020-09-26 17:17:53 +02:00
Benoit Lormeau 1ab6dd67e9 AK: Alphabetically sort the ctype adapters 2020-09-26 17:17:53 +02:00
Benoit Lormeau 66481ad279 AK: Added explanatory comments in GenericLexer.h 2020-09-26 17:17:53 +02:00
asynts 2030084746 AK: Borrow exact format syntax form std::format.
Instead of just implementing format specifiers ad-hog this commit
implements the exact syntax std::format uses.

There are still a ton of features that are not supported by this
implementation, however, the format specifiers should be parsed
correctly.

In some cases however, the format specifiers aren't quite parsed
correctly, for example:

    String::formatted("{:{}}", 42, 4)

should produce the string "  42" however an (unrelated) assertion fails.
This is because vformat doesn't consider nested parentheses. I have to
spend some time coming up with a simple way of doing this, I don't feel
like doing that right now.

The fundamental code for this already exists, by limiting the number of
format arguments (arbitrarily) to 256 large widths are used to encode
that these should be taken from other format parameters.
2020-09-26 00:00:50 +02:00
asynts 84d276dba0 AK: Add GenericLexer::remaining.
This is useful for debugging with printf :^).
2020-09-26 00:00:50 +02:00
Ben Wiederhake 8940bc3503 Meta+AK: Make clang-format-10 clean 2020-09-25 21:18:17 +02:00
asynts 1cb8be9906 Applications+IRCClient: Use new format functions. 2020-09-23 21:45:28 +02:00
asynts 5ed15a49f2 AK: Add outf, warnf and dbgf. 2020-09-23 21:45:28 +02:00
asynts b7a4c4482f AK: Resolve format related circular dependencies properly.
With this commit, <AK/Format.h> has a more supportive role and isn't
used directly.

Essentially, there now is a public 'vformat' function ('v' for vector)
which takes already type erased parameters. The name is choosen to
indicate that this function behaves similar to C-style functions taking
a va_list equivalent.

The interface for frontend users are now 'String::formatted' and
'StringBuilder::appendff'.
2020-09-23 21:45:28 +02:00
asynts 3224fb7d55 AK: Allow calling format without arguments. 2020-09-23 21:45:28 +02:00
asynts 675b482fe7 AK: Add missing overload to format.
I had this in #3580 but I must have lost it during rebasing.
2020-09-22 19:06:06 +02:00
asynts eaeb793454 AK: Use format in String::number. 2020-09-22 15:06:40 +02:00
asynts 90536a1558 AK: Consider long and unsigned long as integral types.
Two things I hate about C++:

 1. 'int', 'signed int' and 'unsigned int' are two distinct types while
    'char, 'signed char' and 'unsigned char' are *three* distinct types.

    This is because 'signed int' is an alias for 'int' but 'signed char'
    can't be an alias for 'char' because on some weird systems 'char' is
    unsigned.

    One might think why not do it the other way around, make 'int' an
    alias for 'signed int' and 'char' an alias for whatever that is on
    the platform, or make 'char' signed on all platforms. But who am I
    to ask?

 2. 'unsigned long' and 'unsigned long long' are always different types,
    even if both are 64 bit numbers.

This commit fixes a few bugs that coming from this.

See Also: 1b3169f405.
2020-09-22 15:06:40 +02:00
asynts e5497a326a AK: Add StringBuilder::appendff using the new format.
StringBuilder::appendf was already used, thus this name. If we some day
replace all usages of printf, we could rename this method.
2020-09-22 15:06:40 +02:00
asynts 4fcdc19b14 AK: Remove strtoull dependency from format.
This function is not avaliable in the kernel.

In the future it would be nice to have some sort of <charconv> header
that does this for all integer types and then call it in strtoull and et
cetera.

The difference would be that this function say 'from_chars' would return
an Optional and not just interpret anything invalid as zero.
2020-09-22 15:06:40 +02:00
asynts 2bda21318c AK: Add format function like std::format or fmt::format. 2020-09-21 20:17:36 +02:00
asynts b5ca74e78a AK: Add template deduction guides for Array. 2020-09-21 20:17:36 +02:00
asynts d831b5738d AK: Add StringView::substring_view(size_t) overload. 2020-09-21 20:17:36 +02:00
asynts 31bb107922 AK: Remove BufferStream class.
There are three classes avaliable that share the functionality of
BufferStream:

 1. InputMemoryStream is for reading from static buffers. Example:

        Bytes input = /* ... */;
        InputMemoryStream stream { input };

        LittleEndian<u32> little_endian_value;
        input >> little_endian_value;

        u32 host_endian_value;
        input >> host_endian_value;

        SomeComplexStruct complex_struct;
        input >> Bytes { &complex_struct, sizeof(complex_struct) };

 2. OutputMemoryStream is for writing to static buffers. Example:

        Array<u8, 4096> buffer;
        OutputMemoryStream stream;

        stream << LittleEndian<u32> { 42 };
        stream << ReadonlyBytes { &complex_struct, sizeof(complex_struct) };

        foo(stream.bytes());

 3. DuplexMemoryStream for writing to dynamic buffers, can also be used
    as an intermediate buffer by reading from it directly. Example:

        DuplexMemoryStream stream;

        stream << NetworkOrdered<u32> { 13 };
        stream << NetowkrOrdered<u64> { 22 };

        NetworkOrdered<u32> value;
        stream >> value;
        ASSERT(value == 13);

        foo(stream.copy_into_contiguous_buffer());

Unlike BufferStream these streams do not use a fixed endianness
(BufferStream used little endian) these have to be explicitly specified.
There are helper types in <AK/Endian.h>.
2020-09-21 09:37:49 +02:00
asynts fa43bf92e4 LibAudio: Use InputMemoryStream instead of BufferStream. 2020-09-21 09:37:49 +02:00
asynts ae9f0e1cd8 AK: Add missing const in Span::operator==. 2020-09-21 09:37:49 +02:00
asynts 1a277ac291 AK: Add OutputMemoryStream::is_end. 2020-09-21 09:37:49 +02:00
asynts c8ed882b8e AK: Add OutputMemoryStream::fill_to_end. 2020-09-15 20:36:45 +02:00
asynts 83d0803861 AK: Re-add OutputMemoryStream for static buffers only. 2020-09-15 20:36:45 +02:00
asynts f18e927827 AK: Remove OutputMemoryStream for DuplexMemoryStream.
OutputMemoryStream was originally a proxy for DuplexMemoryStream that
did not expose any reading API.

Now I need to add another class that is like OutputMemoryStream but only
for static buffers. My first idea was to make OutputMemoryStream do that
too, but I think it's much better to have a distinct class for that.

I originally wanted to call that class FixedOutputMemoryStream but that
name is really cumbersome and it's a bit unintuitive because
InputMemoryStream is already reading from a fixed buffer.

So let's just use DuplexMemoryStream instead of OutputMemoryStream for
any dynamic stuff and create a new OutputMemoryStream for static
buffers.
2020-09-15 20:36:45 +02:00
asynts 96edcbc27c AK: Lower the requirements for InputStream::eof and rename it.
Consider the following snippet:

    void foo(InputStream& stream) {
        if(!stream.eof()) {
            u8 byte;
            stream >> byte;
        }
    }

There is a very subtle bug in this snippet, for some input streams eof()
might return false even if no more data can be read. In this case an
error flag would be set on the stream.

Until now I've always ensured that this is not the case, but this made
the implementation of eof() unnecessarily complicated.
InputFileStream::eof had to keep a ByteBuffer around just to make this
possible. That meant a ton of unnecessary copies just to get a reliable
eof().

In most cases it isn't actually necessary to have a reliable eof()
implementation.

In most other cases a reliable eof() is avaliable anyways because in
some cases like InputMemoryStream it is very easy to implement.
2020-09-14 20:58:12 +02:00
AnotherTest 1674903dcc AK: Fix PrintfImplementation "%x" handling for u32
This also fixes an issue with the color input value being messed up.
oops :P
2020-09-12 15:01:19 +02:00
Ben Wiederhake d16f510805 AK: Fix forward-declaration of Array 2020-09-12 13:46:15 +02:00
Ben Wiederhake 0d3a8d5397 AK: Fix accidentally-recursive call in BitStream 2020-09-12 00:13:29 +02:00
AnotherTest 72edb33670 AK: Generalise 'PrintfImplementation'
This makes PrintfImplementation usable with any sequence, provided that
a 'next element' function can be written for it.
Does not affect the behaviour of printf() and co.
2020-09-11 21:41:23 +02:00
asynts 049f709d0b AK: Calculate the chunk index correctly in DuplexMemoryStream. 2020-09-11 16:07:45 +02:00
asynts 0055a28710 AK: Replace LogStream operator for ReadonlyBytes with dump_bytes.
It wasn't actually possible to call

    const LogStream& operator<<(const LogStream&, ReadonlyBytes);

because it was shadowed by

    template<typename T>
    const LogStream& operator<<(const LogStream& stream, Span<T> span);

not sure how I didn't find this when I added the overload.

It would be possible to use SFINAE to disable the other overload,
however, I think it is better to use a different method entirely because
the output can be very verbose:

    void dump_bytes(ReadonlyBytes);
2020-09-10 14:15:02 +02:00
asynts a7f786fc0a AK: Use TypedTransfer in Span::copy_to. 2020-09-09 20:15:50 +02:00
asynts 910924f559 AK: Moved TypedTransfer into it's own header. 2020-09-09 20:15:50 +02:00
Tom 92e400c7f9 AK: Add Bitmap::find_one_anywhere and optimize Bitmap::find_first
Leverage constexpr and __builtin_ffs for Bitmap::find_first. Also add
a variant Bitmap::find_one_anywhere that can start scanning at a
provided hint.

Also, merge Bitmap::fill_range into the already existing Bitmap::set_range
2020-09-09 13:02:14 +02:00
asynts a7cbc7fcb2 AK: Remove empty destructor from JsonParser. 2020-09-08 14:01:21 +02:00
asynts 70dd97c46e AK: Remove FixedArray class. 2020-09-08 14:01:21 +02:00
asynts ec1080b18a Refactor: Replace usages of FixedArray with Vector. 2020-09-08 14:01:21 +02:00
asynts 9c83d6ff46 Refactor: Replace usages of FixedArray with Array. 2020-09-08 14:01:21 +02:00
asynts 76e37e8c96 AK: Add Array<T, Size> template. 2020-09-08 14:01:21 +02:00
asynts 1b3ecb01a5 AK: Add generic SimpleIterator class to replace VectorIterator. 2020-09-08 14:01:21 +02:00
Muhammad Zahalqa 125ea6a214 AK: Vector use Traits<T>::equals in find
Use Traits<T>::equals for equality checking in search
functions instead of  operator==
2020-09-06 21:56:32 +02:00
Muhammad Zahalqa ad3e6ef344 AK: SinglyLinkedList use Traits<T>::equals in find
Use Traits<T>::equals for equality checking in search
functions instead of  operator==
2020-09-06 21:56:32 +02:00
Tom efac3d27d2 AK: Add Bitmap::count_in_range and Bitmap::fill_range 2020-09-06 21:20:08 +02:00
asynts cd2815ed87 AK: Add LogStream overload for ReadonlyBytes.
This is extremely useful for debugging.
2020-09-06 20:47:35 +02:00
Andreas Kling 9dafbc82ff AK: Add JsonObject::remove() 2020-09-06 16:09:09 +02:00
asynts 4c317a94c7 LibCompress: Simplify logic in deflate implementation. 2020-09-06 12:54:45 +02:00
asynts 6de63782c7 Streams: Consistent behaviour when reading from stream with error.
The streaming operator doesn't short-circuit, consider the following
snippet:

    void foo(InputStream& stream) {
        int a, b;
        stream >> a >> b;
    }

If the first read fails, the second is called regardless. It should be
well defined what happens in this case: nothing.
2020-09-06 12:54:45 +02:00
asynts 359fcf348f AK: Add Buffered<T> which wraps a stream, adding input buffering. 2020-09-06 12:54:45 +02:00
asynts b011f87d34 AK: Add log stream operator overload for Span. 2020-09-06 12:54:45 +02:00
Muhammad Zahalqa fad0c8e712
AK: Make all DoublyLinkedList search methods use Traits<T>::equals (#3404) 2020-09-05 14:17:14 +02:00
asynts 7efd2a6d59 AK: Add OutputMemoryStream class. 2020-09-01 17:25:26 +02:00
asynts 3a2658951b AK: Add DuplexMemoryStream::copy_into_contiguous_buffer. 2020-09-01 17:25:26 +02:00
asynts b68a873067 AK: Move memory streams into their own header. 2020-09-01 17:25:26 +02:00
asynts f9516a99bf AK: Remove history from DuplexMemoryStream.
That feature was really only useful for Compress::DeflateDecompressor
but that is now using CircularDuplexBuffer instead.
2020-09-01 17:25:26 +02:00
asynts 9ce4475907 Streams: Distinguish recoverable and fatal errors. 2020-09-01 17:25:26 +02:00
AnotherTest 441807f96d AK: Add is_any_of(StringView) to GenericLexer 2020-08-31 23:05:58 +02:00