This brings the function name in line with how we usually name those
functions, which is with a `read_` or `write_` prefix depending on what
they do.
While at it, make the internal `_impl` function private and not-virtual,
since there is no good reason to ever override that function.
- Rename to make it clear it's not just for promotion
- Understand 'p' for pawns
- Take a char parameter instead of StringView since it's always 1 char
Previously, the initial position would look like this:
rnbqkbnr//8/8/8/8//RNBQKBNR w KQkq - 0 1
Now, we correctly give pawns the P/p character in FEN output:
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
Also, we only ever have 1 or 0 characters for a piece, so let's return
`Optional<char>` instead of `StringView` from `char_for_piece()`.
This removes this slightly silly pattern:
`make<FooCommand>(FooCommand::from_string(s))`
Also, let's propagate OOM here, even if nobody reacts to it yet.
`Core::DeprecatedFile::absolute_path` uses `stat` to determine whether a
file exists, which will always fail after the first `unveil` call
`aplay` does. Reorder things so we don't get a stack trace thrown at us
for each file being played.
This is done mainly by implementing safe locking on the data structure
keeping the pointers to the PerContextState objects. Therefore, this now
eliminates the need for using LockRefPtr, as SpinlockProtected is enough
for the whole list.
The usage of HashMap in this class was questionable, and according to
Sahan Fernando (the original contributor to the VirGL work also known as
ccapitalK) there was no deep research on which data structure to use for
keeping all pointers to PerContextState objects.
Therefore, this structure is changed to IntrusiveList as the main reason
and advantage to use it is that handling OOM conditions is much more
simple, because if we succeeded to create a PerContextState object, we
can be sure now that inserting it to the list will not cause OOM error
condition.
This is quite useful for userspace applications that can't cope with the
restriction, but it's still useful to impose other non-configurable
restrictions by using jails.
This fixes a bug that was seen when a combination of the grid having
been floated with `float: left` and a `minmax()` column size were used.
The issue was that a grid track size should be considered intrinsically
sized if both the min and max sizes are intrinsic, not just one of them.
Previously, `Heap` would store serialized data in blocks of 1024 bytes
regardless of the actual length. Data longer than 1024 bytes was
silently truncated causing database corruption.
This changes the heap storage to prefix every block with two new fields:
the total data size in bytes, and the next block to retrieve if the data
is longer than what can be stored inside a single block. By chaining
blocks together, we can store arbitrary amounts of data without needing
to change anything of the logic in the rest of LibSQL.
As part of these changes, the "free list" is also removed from the heap
awaiting an actual implementation: it was never used.
Note that this bumps the database version from 3 to 4, and as such
invalidates (deletes) any database opened with LibSQL that is not
version 4.
We are performing a lot of checks on pointers that are performed again
immediately afterwards because of a dereference. This removes the
redundant `VERIFY`s and simplifies a couple others.