Age | Commit message (Collapse) | Author |
|
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.
|
|
|
|
|
|
|
|
This allows you to build URLs by calling setters on an empty URL and
actually get a valid URL at the end.
|
|
|
|
|
|
- inserting an empty string into LibLine Editor triggered an assertion
trying to grow a ByteBuffer by 0 bytes.
|
|
Clang keeps whining that NonnullFooPtrs are in "unknown" state and I'm
not sure how to resolve that right now. Disable the checking until we
can figure it out.
|
|
This matches what other forward() implementations do.
|
|
This patch adds the missing part for the printf of double values to specify
the length of the fraction part. For GVariant, a default of %.2 is used.
|
|
|
|
Our C++ code generator tools have been relying on host-side dbg() being
forwarded to stdout until now. Now they use out() instead.
Hopefully this will make it easier and more enticing to use streams in
userspace programs as well. :^)
|
|
Add find_best_fit() which implements best fit allocation algorithm.
Kmalloc now uses a best fit allocation policy for large allocations.
|
|
AK::Bitmap is extended with find_next_range_of_unset_bits().
The function is implemented using count_trailing_zeroes_32(), which is
optimized on many platforms, that gives a huge performance boost.
Functions find_longest_range_of_unset_bits() and find_first_fit() are
implemented with find_next_range_of_unset_bits(). According to
benchmarks, they are 60-100% faster.
|
|
Add count_trailing_zeroes_32() which is implemented with builtins
if available, otherwise there's a generic fallback.
|
|
Add find_first_fit() which implements first fit algorithm.
|
|
Add set_range() which sets a range of bits to requested value.
Fix code style.
|
|
|
|
Same issue here as we had with RefPtr and NonnullRefPtr.
Since we can't make copies of an owning pointer, we don't get quite the
same static_ptr_cast<T> here. Instead I've only added a new templated
version of OwnPtr::release_nonnull() in this patch, to solve the only
issue that popped up.
I'm not sure what the best solution here is, but this works for now.
|
|
We were allowing this dangerous kind of thing:
RefPtr<Base> base;
RefPtr<Derived> derived = base;
This patch changes the {Nonnull,}RefPtr constructors so this is no
longer possible.
To downcast one of these pointers, there is now static_ptr_cast<T>:
RefPtr<Derived> derived = static_ptr_cast<Derived>(base);
Fixing this exposed a ton of cowboy-downcasts in various places,
which we're now forced to fix. :^)
|
|
|
|
Fixes #1599
|
|
Since ByteBuffer is a Buffer, it should allow us to overwrite parts of
it that we have allocated.
This comes in useful in handling unsequenced writes like handling
fragmented ip packets :^)
|
|
With relative filenames in the executable code, the executable is basically not
relocatable. This makes out-of-source builds unneccesery hard. This patchset moves
the relative link into the filesystem: that can be handled much easier :^)
|
|
This patchsets adds the semantic check of two values. One first approach
was to compare the (generated) json strings of the two values. This works
out in the most cases, but not with numbers, where "1.0" and "1" in JSON
format are semantically the same. Therefore, this patch adds deep (recursive)
check of two JsonValues.
|
|
This adds a replace functionality that replaces a string that contains
occurences of a "needle" by a "replacement" value. With "all_occurences"
enabled, all occurences are being replaced, otherwise only the first
occurence is being replaced.
|
|
|
|
* Add double number to object serializer
* Handle negative double numbers correctly
* Handle \r and \n in quoted strings independently
This improves the situation when keys contain \r or \n that currently
has the effect that "a\rkey" and "a\nkey" in an JSON object are the
same key value.
|
|
This patchset allows double numbers to be printed with the printf function.
The fraction will always be printed as 6 digit number. This can be improved :^)
|
|
This commit adds a basic implementation of
the ptrace syscall, which allows one process
(the tracer) to control another process (the tracee).
While a process is being traced, it is stopped whenever a signal is
received (other than SIGCONT).
The tracer can start tracing another thread with PT_ATTACH,
which causes the tracee to stop.
From there, the tracer can use PT_CONTINUE
to continue the execution of the tracee,
or use other request codes (which haven't been implemented yet)
to modify the state of the tracee.
Additional request codes are PT_SYSCALL, which causes the tracee to
continue exection but stop at the next entry or exit from a syscall,
and PT_GETREGS which fethces the last saved register set of the tracee
(can be used to inspect syscall arguments and return value).
A special request code is PT_TRACE_ME, which is issued by the tracee
and causes it to stop when it calls execve and wait for the
tracer to attach.
|
|
Some of these are very inefficient. It's nice to have some optimization
opportunities in the future though. :^)
|
|
Instead of simply outputting the character. This way, we get proper padding
support and other niceties strings enjoy.
|
|
|
|
This patch adds the parsing of double values to the JSON parser.
There is another char buffer that get's filled when a "." is present
in the number parsing. When number finished, a divider is calculated
to transform the number behind the "." to the actual fraction value.
|
|
This allows to retrieve a default value for items thare are not
available in the json object.
|
|
|
|
String.h no longer pulls in StringView.h. We do this by moving a bunch
of String functions out-of-line.
|
|
|
|
And share the code with String by moving the logic to StringUtils. :^)
|
|
|
|
FlyString is a flyweight string class that wraps a RefPtr<StringImpl>
known to be unique among the set of FlyStrings. The class is very
unoptimized at the moment.
When to use FlyString:
- When you want O(1) string comparison
- When you want to deduplicate a lot of identical strings
When not to use FlyString:
- For strings that don't need either of the above features
- For strings that are likely to be unique
|
|
This patch adds a generic StringBuilder::join(separator, collection):
Vector<String> strings = { "well", "hello", "friends" };
StringBuilder builder;
builder.join("+ ", strings);
builder.to_string(); // "well + hello + friends"
|
|
Now it's possible to use range-based for loops with String and StringView.
|