Age | Commit message (Collapse) | Author |
|
We should still accept file:/// in the URL parser. :^)
|
|
|
|
This allows you to release a NonnullOwnPtr<T> into a NonnullOwnPtr<U>
|
|
LogStream::operator<<(const LogStream&, long) was implemented in
AK/LogStream.cpp but the declaration was missing from the header.
|
|
When we switched the Bitmap code to operating 32 bits at a time,
we neglected to look in the trailing remainder bits after the last
full 32-bit word.
This patch fixes that and adds a couple of tests for Bitmap that I
hacked up while tracking down this bug.
I found this bug when noticing that the kernel would OOM while there
were still some pages left in the physical page allocator.
|
|
StringView::to_string() was added in 917ccb1 but not actually used
anywhere yet.
|
|
This allows easy creation of a new string from an existing StringView.
Can be used e.g. for output with printf(..., view.to_string().characters())
instead of writing printf(..., String{view}.characters()).
|
|
|
|
|
|
We're now clever enough to notice when we're constructing a FlyString
from a String that is actually already a FlyString. :^)
|
|
|
|
zeroPad => zero_pad
leftPad => left_pad
fieldWidth => field_width
These were the only variables with names in camelCase.
We were not consistent with the naming of these variables: some times we
called them zeroPad, leftPad, fieldWidth; other times we called them
zero_pad, left_pad, field_width.
These inconsistencies made the code hard to read, so I changed their
names to snake_case.
Also rename width => field_width in AK::print_hex()
|
|
These methods search from the beginning or end of a string for the
first character in the input StringView and returns the position in
the string of the first match. Note that this is not a substring match.
Each comes with single char overloads for efficiency.
|
|
This function is just like resize() except it does not deallocate the
vector buffer when shrinking.
|
|
|
|
|
|
|
|
Apparently Clang does not have __builtin_foo_overflow_p()
Fixes #2044.
|
|
It's tedious to write (and look at) [[gnu::always_inline]] etc. :^)
|
|
|
|
Due to us using size_t for the length, the actual value will always be positive.
If, for example, we calculate the length as "0 - 1", we'll get SIZE_T_MAX. What
we can do is check that adding the characters pointer and the length together
doesn't overflow.
|
|
And switch the two-argument version of Checked::multiplication_would_overflow()
to use __builtin_mul_overflow_p(). This helps GCC optimize the code better.
|
|
|
|
It's useful to be able to tell if we are at the beginning of
the list when using the list as a queue.
|
|
|
|
|
|
|
|
Add the ability to easily convert between timeval and timespec.
|
|
Make it constexpr and do perfect forwarding.
|
|
There were some ideas about how to use this class but we never actually
started using it, so let's just simplify it and get it ready for use.
The basic idea is: a function returns a Result<ValueType, ErrorType>.
Callers check if the result object is_error(). If so, an ErrorType can
be fetched with the error() getter. Otherwise, a ValueType is fetched
with the value() getter. That's it. :^)
|
|
|
|
DWARF line number information, if generated, is stored in the
.debug_line section of an object file.
The information is encoded as instructions for a VM that is defined in
the DWARF specification.
By executing these instructions, we can extract the encoded line number
information.
|
|
We allow the ref-counting parts of an object to be mutated even when the
object itself is a const.
An important detail is that we allow invoking 'will_be_destroyed' and
'one_ref_left', which are not required to be const qualified, on const
objects.
|
|
This is an utility to create a URL from a given string, which may be either a
URL such as http://example.com (which will be used as-is), or a file path such
as /etc/fstab (which will be transformed into file:///etc/fstab).
|
|
Not just http or https. This fixes "foo" being recognized as a valid URL with
protocol "foo", empty host and empty path.
|
|
This is a convenience helper that allows you to easily construct a
file:// URL from an absolute path.
|
|
|
|
|
|
|
|
This allows you to comfortably test if multiply 2 or 3 values would
cause arithmetic overflow.
|
|
A Checked<T> is a boxed integer type that asserts if you try to use its
value after an arithmetic overflow.
|
|
|
|
This provides min(), max() and is_signed() for the basic integer types.
|
|
Just to verify that the parts are all null-terminated.
|
|
Also, added AK::String::index_of and fixed a bug in ELF::Loader::symbol_ptr
|
|
Since the FlyString deduplication mechanism uses a HashTable, we know
that any StringImpl inside a non-null FlyString will already have its
lazily computed hash.
|
|
This turns into much less code in the most common cases, here's why:
The normal Optional usage pattern is something like:
auto foo = get_me_an_optional();
if (foo.has_value())
do_stuff_with(foo.value());
In this typical scenario, we check has_value() before calling value().
Without inlining, value() will double-check has_value() itself and
assert if it fails. Inlining allows the compiler to optimize all of
this away.
|
|
|
|
|
|
|