summaryrefslogtreecommitdiff
path: root/AK
AgeCommit message (Collapse)Author
2020-04-15AK: Add a Checked<T> templateAndreas Kling
A Checked<T> is a boxed integer type that asserts if you try to use its value after an arithmetic overflow.
2020-04-15AK: Add MakeUnsigned<T> helper templateAndreas Kling
2020-04-15AK: Add a simple NumericLimits<T> templateAndreas Kling
This provides min(), max() and is_signed() for the basic integer types.
2020-04-14AK: Add a little test for String::split()Andreas Kling
Just to verify that the parts are all null-terminated.
2020-04-13LibELF: Add find_demangled_functionItamar
Also, added AK::String::index_of and fixed a bug in ELF::Loader::symbol_ptr
2020-04-13AK: Let FlyString::hash() assume that the string was already hashedAndreas Kling
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.
2020-04-12AK: Inline Optional functions more aggressivelyAndreas Kling
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.
2020-04-12AK: Add LogStream operator<< overloads for float and doubleAndreas Kling
2020-04-12AK: Parse query and fragment in URL::parse()Linus Groh
2020-04-12AK: Support fragment in URLLinus Groh
2020-04-11AK: Recompute URL validity after changing protocol/host/pathAndreas Kling
This allows you to build URLs by calling setters on an empty URL and actually get a valid URL at the end.
2020-04-11AK: String::contains() should say no if needle or haystack is nullAndreas Kling
2020-04-10AK: Add FlyString::hash()Andreas Kling
2020-04-08AK: Appending 0 bytes to a ByteBuffer should be a no-op (#1699)Paul Redmond
- inserting an empty string into LibLine Editor triggered an assertion trying to grow a ByteBuffer by 0 bytes.
2020-04-07AK: Disable the consumable annotation checking to fix Clang buildAndreas Kling
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.
2020-04-07AK: Add forward() overload that refuses to forward lvalue as rvalueAndreas Kling
This matches what other forward() implementations do.
2020-04-07AK: Allow %m.nf specifier for double/float in printf to set fraction withEmanuel Sprung
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.
2020-04-06AK: Make dbgprintf() and dbgputstr() go to stderr on non-Serenity hostsAndreas Kling
2020-04-06AK: Add out() and warn() streams that forward to stdout and stderrAndreas Kling
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. :^)
2020-04-06Kernel: Support best fit allocation policy in kmalloc()nimelehin
Add find_best_fit() which implements best fit allocation algorithm. Kmalloc now uses a best fit allocation policy for large allocations.
2020-04-06Bitmap: Add Bitmap::find_next_range_of_unset_bits()nimelehin
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.
2020-04-06AK: Add count_trailing_zeroes_32()nimelehin
Add count_trailing_zeroes_32() which is implemented with builtins if available, otherwise there's a generic fallback.
2020-04-06AK: Add Bitmap::find_first_fit()nimelehin
Add find_first_fit() which implements first fit algorithm.
2020-04-06AK: Add Bitmap::set_range()nimelehin
Add set_range() which sets a range of bits to requested value. Fix code style.
2020-04-06AK: Make FlyString a little less hilariously unoptimized :^)Andreas Kling
2020-04-05AK: Stop allowing implicit downcast with OwnPtr and NonnullOwnPtrAndreas Kling
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.
2020-04-05AK: Stop allowing implicit downcast with RefPtr and NonnullRefPtrAndreas Kling
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. :^)
2020-04-05Kernel+AK: Separate out MACAddress and move it into AKAnotherTest
2020-04-04AK: Break on end of input in JsonParser::consume_quoted_stringTibor Nagy
Fixes #1599
2020-04-03AK: Add an overwrite API to ByteBufferAnotherTest
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 :^)
2020-04-03AK: Remove relative path in AK testsuiteEmanuel Sprung
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 :^)
2020-04-01AK: Add equals method to JsonValue to semantically compare two values.Emanuel Sprung
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.
2020-04-01AK: Add String::replace() functionalityEmanuel Sprung
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.
2020-04-01AK: Add adopt_own() to create a NonnullOwnPtr<T> from a T&Andreas Kling
2020-03-31AK: A few JSON improvementsEmanuel Sprung
* 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.
2020-03-31AK: Print double numbers with printfEmanuel Sprung
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 :^)
2020-03-28Kernel: Add 'ptrace' syscallItamar
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.
2020-03-28AK: Add some string comparison operatorsAndreas Kling
Some of these are very inefficient. It's nice to have some optimization opportunities in the future though. :^)
2020-03-26AK: Use print_string() for %c formattingSergey Bugaev
Instead of simply outputting the character. This way, we get proper padding support and other niceties strings enjoy.
2020-03-24AK: Fix JsonParser kernel build (no floats/doubles in kernel code)Andreas Kling
2020-03-24AK: Add parsing of JSON double valuesEmanuel Sprung
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.
2020-03-24AK: Add get_or() method to JsonObjectEmanuel Sprung
This allows to retrieve a default value for items thare are not available in the json object.
2020-03-24AK: Add FlyString::is_null()Andreas Kling
2020-03-23AK: Reduce header dependency graph of String.hAndreas Kling
String.h no longer pulls in StringView.h. We do this by moving a bunch of String functions out-of-line.
2020-03-22AK: Add FlyString::to_lowercase() and LogStream operator<<(FlyString)Andreas Kling
2020-03-22AK: Add FlyString::equals_ignoring_case(StringView)Andreas Kling
And share the code with String by moving the logic to StringUtils. :^)
2020-03-22AK: Run clang-format on StringUtils.{cpp,h}Andreas Kling
2020-03-22AK: Add FlyString, a simple flyweight string classAndreas Kling
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
2020-03-20AK: Add StringBuilder::join() for joining collections with a separatorAndreas Kling
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"
2020-03-10AK: Add begin() and end() to String and StringViewhowar6hill
Now it's possible to use range-based for loops with String and StringView.