summaryrefslogtreecommitdiff
path: root/AK/StringImpl.cpp
AgeCommit message (Collapse)Author
2021-05-17AK: Include HashTable.h in StringImpl.cppAli Mohammad Pur
This was used without an include, I'm not sure how it didn't break before :P
2021-05-14AK: Remove unused STRINGIMPL_DEBUG instrumentationAndreas Kling
2021-05-14AK: Make StringView::hash() constexprAndreas Kling
This required moving string_hash() to its own header so that everyone can see it.
2021-04-23AK: Rename adopt() to adopt_ref()Andreas Kling
This makes it more symmetrical with adopt_own() (which is used to create a NonnullOwnPtr from the result of a naked new.)
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-02-23Everywhere: Rename ASSERT => VERIFYAndreas Kling
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
2021-01-25Everywhere: Hook up remaining debug macros to Debug.h.asynts
2021-01-25Everywhere: Remove unnecessary debug comments.asynts
It would be tempting to uncomment these statements, but that won't work with the new changes. This was done with the following commands: find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec awk -i inplace '$0 !~ /\/\/#define/ { if (!toggle) { print; } else { toggle = !toggle } } ; $0 ~/\/\/#define/ { toggle = 1 }' {} \; find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec awk -i inplace '$0 !~ /\/\/ #define/ { if (!toggle) { print; } else { toggle = !toggle } } ; $0 ~/\/\/ #define/ { toggle = 1 }' {} \;
2020-11-25AK: Don't return empty StringImpl from create() when char* starts with \0Linus Groh
When creating a StringImpl for a C string that starts with a null-byte, we would ignore the explicitly given length and return the empty StringImpl - presumably to check for "\0", but this leads to false positives ("\0foo") so let's only care about the length.
2020-10-08AK: Use new format functions.asynts
2020-08-30AK: Add missing declaration in StringImpl.cppAndreas Kling
2020-08-30AK: Unbreak building with extra debug macrosBen Wiederhake
2020-08-06AK: Add String constructor from ReadonlyBytes.asynts
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-08AK: Move memory stuff (fast memcpy, etc) to a separate headerAndreas Kling
Move the "fast memcpy" stuff out of StdLibExtras.h and into Memory.h. This will break a ton of things that were relying on StdLibExtras.h to include a bunch of other headers. Fix will follow immediately after. This makes it possible to include StdLibExtras.h from Types.h, which is the main point of this exercise.
2020-02-25AK: Have AK/kmalloc.h #include <new> on other platformsAndreas Kling
This should make stuff like placement new work correctly when building outside of Serenity. This stuff is a bit delicate due to the weirdly staged toolchain build at the moment. Hopefully we can unify this stuff in the future.
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.
2019-12-09AK: Use size_t for the length of stringsAndreas Kling
Using int was a mistake. This patch changes String, StringImpl, StringView and StringBuilder to use size_t instead of int for lengths. Obviously a lot of code needs to change as a result of this.
2019-09-13Revert "AK: Made Strings reversible"Andreas Kling
This reverts commit 26e81ad574d463faee19f5973108f80d0e02aaf6. We forgot to consider UTF-8 here. String is UTF-8 and we need to be careful about things like this.
2019-09-13AK: Made Strings reversibleJesse Buhagiar
`AK::String` can now be reversed via AK::String::reverse(). This makes life a lot easier for functions like `itoa()`, where the output ends up being backwards. Very much not like the normal STL (which requires an `std::reverse` object) way of doing things. A call to reverse returns a new `AK::String` so as to not upset any of the possible references to the same `StringImpl` shared between Strings.
2019-06-24StringImpl: Fix possible uninitialized access in StringImpl::create().Andreas Kling
If the provided length is 0, there's no need to dereference the const char*.
2019-06-21AK: Rename RetainPtr => RefPtr and Retained => NonnullRefPtr.Andreas Kling
2019-06-20AK: Make StringImpl a bit smaller.Andreas Kling
There's no need for a member char* m_characters if we always store them in the inline buffer. So with this patch, we now do. After that, rearrange the members a bit for ideal packing. :^)
2019-06-14AK: Massage it into building on my host system without breaking Serenity.Andreas Kling
2019-05-28Add clang-format fileRobin Burchell
Also run it across the whole tree to get everything using the One True Style. We don't yet run this in an automated fashion as it's a little slow, but there is a snippet to do so in makeall.sh.
2019-04-07AK: Improve StringImpl chomping a bit.Andreas Kling
Chomp off any number of trailing [\0\n\r] characters and trim the allocation to fit instead of keeping the original size.
2019-03-12Kernel: Cache MAC<->IP mappings (from ARP responses) seen on the wire.Andreas Kling
2019-02-25More moving towards using signed types.Andreas Kling
I'm still feeling this out, but I am starting to like the general idea.
2019-02-25Convert more RetainPtr use to Retained.Andreas Kling
2019-02-17AK: Fix broken instrumentation code for StringImpl.Andreas Kling
2019-02-06Bootloader: Locate the kernel's data segment and clear it.Andreas Kling
This was a constant source of stupid bugs and I kept postponing it because I wasn't in the mood to write assembly code. Until now! :^)
2019-02-03Get nyancat nyanning in Serenity.Andreas Kling
I found a cute program that renders an animated nyancat in the terminal. This patch adds enough hackery to get it working correctly. :^)
2019-01-31Big, possibly complete sweep of naming changes.Andreas Kling
2018-12-28Plug leaks in SynthFS::remove_file().Andreas Kling
The process spawn stress test can now run forever. :^)
2018-12-21Yet another pass of style fixes.Andreas Kling
2018-12-04Import a simple text editor I started working on.Andreas Kling
2018-11-09Make kernel build with clang.Andreas Kling
It's a bit faster than g++ and seems to generate perfectly fine code. The kernel is also roughly 10% smaller(!)
2018-11-07Add a Chomp feature to String construction that removes a trailing newline.Andreas Kling
This will be useful in many situations.
2018-10-22Add a CircularQueue template class to AK.Andreas Kling
2018-10-22Oops, StringImpl's "the empty string" global was not always initialized.Andreas Kling
These "oops forgot to initialize" bugs are getting annoying...
2018-10-17Integrate ext2 from VFS into Kernel.Andreas Kling
2018-10-16Reduce dependence on STL.Andreas Kling
2018-10-10Import all this stuff into a single repo called Serenity.Andreas Kling