summaryrefslogtreecommitdiff
path: root/AK
AgeCommit message (Collapse)Author
2020-02-01AK: #ifdef out the contents of SharedBuffer on other platformsAndreas Kling
2020-02-01AK: Always inline StringView(const char*)Andreas Kling
Also use strlen() instead of manually walking the string. This allows GCC to optimize away the strlen() entirely for string literals. :^)
2020-02-01AK: Add some integer overloads to JsonObjectSerializerAndreas Kling
This avoids constructing a temporary JsonValue just to append an int.
2020-01-31AK: Add FixedArray::data()William McPherson
2020-01-26Ext2FS: allocate_blocks allocates contiguous blocks (#1095)Marios Prokopakis
This implementation uses the new helper method of Bitmap called find_longest_range_of_unset_bits. This method looks for the biggest range of contiguous bits unset in the bitmap and returns the start of the range back to the caller.
2020-01-25Build: Remove -fno-sized-deallocation -Wno-sized-deallocationAndreas Kling
Add sized variants of the global operator delete functions so we don't have to use these GCC options anymore.
2020-01-25AK: Vector::is_null() should always return falseAndreas Kling
This is only used by the somewhat dubious templated String::copy(). An empty Vector should generate an empty String when copied, never a null String.
2020-01-25AK: Assert if trying to create a WeakPtr to an object being destroyedAndreas Kling
Trying to make_weak_ptr() on something that has begun destruction is very unlikely to be what you want. Let's assert if that scenario comes up so we can catch it immediately.
2020-01-24Meta: Claim copyright for files created by meSergey Bugaev
This changes copyright holder to myself for the source code files that I've created or have (almost) completely rewritten. Not included are the files that were significantly changed by others even though it was me who originally created them (think HtmlView), or the many other files I've contributed code to.
2020-01-24AK: Use swap-based assignment in OwnPtrAndreas Kling
Also provide a specialized swap(OwnPtr, OwnPtr) that allows swapping an OwnPtr with itself.
2020-01-23AK: Let's call decrementing reference counts "unref" instead of "deref"Andreas Kling
It always bothered me that we're using the overloaded "dereference" term for this. Let's call it "unreference" instead. :^)
2020-01-22AK: Unbreak FileSystemPath after String::split() changesAndreas Kling
FileSystemPath(".") should not have a title(). This was caught by the unit test for FileSystemPath, yay! :^)
2020-01-22AK: Also add a keep_empty argument to String::split[_limit]()Sergey Bugaev
Just like String[View]::split_view() has already.
2020-01-21Kernel: Tidy up debug logging a little bitAndreas Kling
When using dbg() in the kernel, the output is automatically prefixed with [Process(PID:TID)]. This makes it a lot easier to understand which thread is generating the output. This patch also cleans up some common logging messages and removes the now-unnecessary "dbg() << *current << ..." pattern.
2020-01-20AK: Allow clamp() with min==maxAndreas Kling
2020-01-20Kernel+AK: Add/fix uintptr_t and intptr_t definitionsAndreas Kling
We should move towards using uintptr_t instead of u32 for pointers everywhere, to prepare for an eventual 64-bit port.
2020-01-20AK: Add clamp() functionShannon Booth
This function can be used to more cleanly write the common operation of clamping a value between two values.
2020-01-19AK: Add NonnullOwnPtr::swap() as well for symmetryAndreas Kling
2020-01-19Kernel: Optimize VM range deallocation a bitAndreas Kling
Previously, when deallocating a range of VM, we would sort and merge the range list. This was quite slow for large processes. This patch optimizes VM deallocation in the following ways: - Use binary search instead of linear scan to find the place to insert the deallocated range. - Insert at the right place immediately, removing the need to sort. - Merge the inserted range with any adjacent range(s) in-line instead of doing a separate merge pass into a list copy. - Add Traits<Range> to inform Vector that Range objects are trivial and can be moved using memmove(). I've also added an assertion that deallocated ranges are actually part of the RangeAllocator's initial address range. I've benchmarked this using g++ to compile Kernel/Process.cpp. With these changes, compilation goes from ~41 sec to ~35 sec.
2020-01-19AK: Teach Vector::insert() to use memmove() for trivial typesAndreas Kling
2020-01-19AK: Support '+' qualifier in printf() to force sign for positive %d'sAndreas Kling
2020-01-19AK: Make it possible to swap() a NonnullRefPtr with itselfAndreas Kling
The generic swap() is not able to swap a NonnullRefPtr with itself, due to its use of a temporary and NonnullRefPtr asserting when trying to move() from an already move()'d instance.
2020-01-19AK: Add some missing "inline" keywords in StdLibExtras.hAndreas Kling
2020-01-18AK: NonnullRefPtr should allow assigning owner to owneeAndreas Kling
Given the following situation: struct Object : public RefCounted<Object> { RefPtr<Object> parent; } NonnullRefPtr<Object> object = get_some_object(); object = *object->parent; We would previously crash if 'object' was the only strongly referencing pointer to 'parent'. This happened because NonnullRefPtr would unref the outgoing pointee before reffing the incoming pointee. This patch fixes that by implementing NonnullRefPtr assignments using pointer swaps, just like RefPtr already did.
2020-01-18Meta: Add license header to source filesAndreas Kling
As suggested by Joshua, this commit adds the 2-clause BSD license as a comment block to the top of every source file. For the first pass, I've just added myself for simplicity. I encourage everyone to add themselves as copyright holders of any file they've added or modified in some significant way. If I've added myself in error somewhere, feel free to replace it with the appropriate copyright holder instead. Going forward, all new source files should include a license header.
2020-01-16Kernel+LibELF: Don't blindly trust ELF symbol offsets in symbolicationAndreas Kling
It was possible to craft a custom ELF executable that when symbolicated would cause the kernel to read from user-controlled addresses anywhere in memory. You could then fetch this memory via /proc/PID/stack We fix this by making ELFImage hand out StringView rather than raw const char* for symbol names. In case a symbol offset is outside the ELF image, you get a null StringView. :^) Test: Kernel/elf-symbolication-kernel-read-exploit.cpp
2020-01-15AK: Add Vector::unstable_remove(index)Andreas Kling
This removes an item at an index without preserving the sort order of the Vector. This enables constant-time removal from unsorted Vectors, as it avoids shifting all of the entries following the removed one.
2020-01-14AK: Fix String[View]::split_view() returning an extra empty partSergey Bugaev
If the last character was the separator and keep_empty is true, the previous if statement would have already appended the last empty part, so no need to do this again. This was even more problematic, because the result of split_view() is expected to consist of true substrings that are usable with the StringView::substring_view_starting_*_substring() methods, not of equal strings located elsewhere. Fixes https://github.com/SerenityOS/serenity/issues/970 See https://github.com/SerenityOS/serenity/pull/938
2020-01-14AK: Don't return null from String[View]::substring_view()Sergey Bugaev
We expect the result to be usable with the StringView::substring_view_starting_*_substring() methods. See https://github.com/SerenityOS/serenity/pull/938
2020-01-13AK: Add ArmedScopeGuard, a scope guard that can be disarmedAndrew Kaster
2020-01-12AK: Run clang-format on Atomic.hAndreas Kling
Also use <AK/Types.h> instead of <stddef.h>
2020-01-07AK: Add assertions to FixedArray::operator[]Andreas Kling
Let's catch ourselves if we ever index out of bounds into one of these.
2020-01-07AK: Add dirname() to FileSystemPathConrad Pankoff
2020-01-06AK: Fix test compile warningsShannon Booth
These warnings are pretty harmless, but warnings nonetheless.
2020-01-06AK+Demos+Libraries: Remove executable permissions from {.cpp,.h} filesShannon Booth
2020-01-05LibCore: IDAllocator should never vend ID 0Andreas Kling
This was tripping up CObject which interprets timer ID 0 as "no timer". Once we got ID 0 assigned, it was impossible to turn it off and it would fire on every event loop iteration, causing CPU churn.
2020-01-05AK+LibCore: Add an IDAllocator and use to allocate timer idsShannon Booth
2020-01-05AK: Add a u64 Trait typeShannon Booth
This allows u64s to be used in HashMaps.
2020-01-04AK: Allow copying a Vector from a Vector with different inline capacityAndreas Kling
2020-01-02Build: HOST_CXX -> USE_HOST_CXXjoshua stein
Allow HOST_CXX to be passed to make which will be the actual host C++ compiler used, such as 'make HOST_CXX=clang++'.
2020-01-01Build: AK/Tests: use Makefile.commonjoshua stein
2020-01-01AK: Move the userspace SharedBuffer from LibC to AKAndreas Kling
This always felt out-of-place in LibC.
2020-01-01AK: Turn off demangler in userlandAndrew Kaster
For some reason, the default CXXFLAGS and such don't get us the __cxa_demangle symbol in userland.
2019-12-30AK: Use stack buffers in String::number() to avoid some malloc() callsAndreas Kling
2019-12-30AK: Add JsonObject::get_ptr() for copy-free lookupAndreas Kling
This variant of get() returns a const JsonValue* instead of a JsonValue and can be used when you want to peek into a JsonObject's member fields without making copies.
2019-12-29AK: Fix JSON parser crashing when encountering UTF-8Andreas Kling
The mechanism that caches the most recently seen string for each first character was indexing into the cache using a 'char' subscript. Oops!
2019-12-29AK: Add StringView::ends_with functionShannon Booth
2019-12-28AK: Unbreak Tests Makefile. Turns out this newline was effectful :^)Andreas Kling
2019-12-28Build: wrap make invocations with flock(1)joshua stein
Lock each directory before entering it so when using -j, the same dependency isn't built more than once at a time. This doesn't get full -j parallelism though, since one make child will be sitting idle waiting for flock to receive its lock and continue making (which should then do nothing since it will have been built already). Unfortunately there's not much that can be done to fix that since it can't proceed until its dependency is built by another make process.
2019-12-27AK: Fix unused parameter bug in SinglyLinkedList (#928)Valtteri Koskivuori