Commit Graph

704 Commits

Author SHA1 Message Date
Andreas Kling
6824cb17a6 AK: Have AK/kmalloc.h #include <new> on other platforms
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-02-25 15:58:24 +01:00
Andreas Kling
00e744c263 AK: Provide a ptr_hash(const void*) overload 2020-02-25 15:37:07 +01:00
joshua stein
7e6ac544f7 AK: Add ptr_hash to use int_hash or u64_hash depending on pointer size 2020-02-25 15:32:58 +01:00
Andreas Kling
960cae924a AK: Some more int => size_t in Bitmap 2020-02-25 15:11:15 +01:00
Andreas Kling
fbe4081f4b AK: Make Queue use size_t for its size 2020-02-25 14:55:04 +01:00
Andreas Kling
ceec1a7d38 AK: Make Vector use size_t for its size and capacity 2020-02-25 14:52:35 +01:00
Emanuel Sprung
074d935c6e AK, LibGfx, LibGUI: Initialize various variables to zero.
The not initialized variables can lead to compiler warnings that
become errors with the -Werror flag.
2020-02-25 10:18:46 +01:00
Andreas Kling
17846dd063 AK: Zero-initialize the internal storage of Optional 2020-02-24 10:22:27 +01:00
Andreas Kling
0763f67043 AK: Make Bitmap use size_t for its size
Also rework its API's to return Optional<size_t> instead of int with -1
as the error value.
2020-02-24 09:56:07 +01:00
Andreas Kling
b813b2f871 AK: Make HashTable and HashMap use size_t for size and capacity 2020-02-24 09:42:52 +01:00
Shannon Booth
ba9313111f AK: Add StringBuilder::is_empty() 2020-02-22 21:36:54 +01:00
Shannon Booth
854f0b9e1a AK: Add StringView::starts_with(char) & StringView::ends_with(char)
This is simply meant to be a more efficient implementation in the
case that we only need to check a single character.
2020-02-22 21:36:54 +01:00
Andreas Kling
c4c1ad2289 Toolchain: Build demangling into LibC except during toolchain build 2020-02-21 18:54:57 +01:00
Andreas Kling
7592f9afd5 AK: Use size_t for CircularQueue and CircularDeque 2020-02-20 13:20:34 +01:00
Andreas Kling
88b9fcb976 AK: Use size_t for ByteBuffer sizes
This matches what we already do for string types.
2020-02-20 13:20:34 +01:00
Andreas Kling
23a54636ea AK: Fix bug where "%s" with field width would print too many characters
I introduced this while implementing "%.*s", oops.
2020-02-19 23:02:15 +01:00
Andreas Kling
151467b569 AK: Support "%.*s" in format strings
Work towards #623.
2020-02-19 22:08:13 +01:00
Liav A
01ae3e9c85 AK: Use endianness flags to determine if conversion is necessary 2020-02-19 16:08:28 +01:00
Andreas Kling
a7dbb3cf96 Kernel: Use a FixedArray for a process's extra GIDs
There's not really enough of these to justify using a HashTable.
2020-02-18 11:35:47 +01:00
Sergey Bugaev
bf8dacf0c1 Kernel: Add placement new[] operator 2020-02-18 11:23:27 +01:00
Andreas Kling
48f7c28a5c Kernel: Replace "current" with Thread::current and Process::current
Suggested by Sergey. The currently running Thread and Process are now
Thread::current and Process::current respectively. :^)
2020-02-17 15:04:27 +01:00
Andreas Kling
a6e69bda71 AK: Add basic Traits for RefPtr
This allows RefPtr to be stored in a HashTable<RefPtr<T>> :^)

It's unfortunate about the const_casts. We'll need to fix HashMap::get
to play nice with non-const Traits<T>::PeekType at some point.
2020-02-16 21:58:17 +01:00
Andreas Kling
02e199a9cb AK: Don't construct a String every time we LogStream<< a number 2020-02-16 12:48:58 +01:00
Kaif Mavani
fa21c7e8bf
AK: Fixed a typo in NeverDestroyed.h (#1228) 2020-02-16 09:32:18 +01:00
Andreas Kling
e61cdf5c39 AK: Add HashMap, HashTable and Traits to Forward.h 2020-02-16 02:01:18 +01:00
Andreas Kling
a356e48150 Kernel: Move all code into the Kernel namespace 2020-02-16 01:27:42 +01:00
Andreas Kling
d42f0f4661 AK: Add missing include in CircularQueue.h 2020-02-16 01:27:25 +01:00
Andreas Kling
f27a646bf5 AK: Don't bring in LibBareMetal's kstdio.h in userspace 2020-02-15 19:18:56 +01:00
Andreas Kling
b515ea454f AK: Make sure that Weakable always has the same memory layout
Weakable objects ended up with differing memory layouts in some ports
since they don't build with the DEBUG macro defined.

Instead of forcing ports to define DEBUG, just put this behind a custom
WEAKABLE_DEBUG macro and leave it always-on for now.
2020-02-15 14:49:57 +01:00
Andreas Kling
175cd4d9c2 AK: Fix broken #include statement 2020-02-15 13:28:33 +01:00
Andreas Kling
dc417ada6d AK: Add BufferStream to Forward.h 2020-02-15 12:10:48 +01:00
Shannon Booth
9920d17342 AK: Add String starts_with(char) & ends_with(char)
This is simply meant to be a more efficient implementation in the
case that we only need to check a single character.
2020-02-15 11:40:05 +01:00
Andreas Kling
d85b09893d AK: Add Utf8View to Forward.h 2020-02-14 23:31:18 +01:00
Andreas Kling
22b41a0fa3 AK: Add LogStream and DebugLogStream to Forward.h 2020-02-14 23:31:18 +01:00
Andreas Kling
184475d45a AK: Add SharedBuffer to Forward.h 2020-02-14 23:31:18 +01:00
Andreas Kling
8f7333f080 LibCore: Add a forward declaration header
This patch adds <LibCore/Forward.h> and uses it in various places to
shrink the header dependency graph.
2020-02-14 23:31:18 +01:00
Andreas Kling
3bbf4610d2 AK: Add a forward declaration header
You can now #include <AK/Forward.h> to get most of the AK types as
forward declarations.

Header dependency explosion is one of the main contributors to compile
times at the moment, so this is a step towards smaller include graphs.
2020-02-14 23:31:18 +01:00
Andreas Kling
3e486f75ff AK: Move escape_html_entities() from LibHTML to AK
This sort of thing can be useful to things that don't want to link with
all of LibHTML.
2020-02-13 08:46:00 +01:00
Andreas Kling
6cbd72f54f AK: Remove bitrotted Traits::dump() mechanism
This was only used by HashTable::dump() which I used when doing the
first HashTable implementation. Removing this allows us to also remove
most includes of <AK/kstdio.h>.
2020-02-10 11:55:34 +01:00
Liav A
8bdb08c354 AK: Apply changes for the Bootstrapper environment 2020-02-09 19:38:17 +01:00
Andreas Kling
80b1af2352 AK: Make StringBuilder::to_string() non-destructive
This was an artifact of an earlier design of StringBuilder where I had
attempted to preserve the same allocation from build to final String.
2020-02-09 14:15:55 +01:00
Andreas Kling
745ea2a0ef AK: Add JsonObjectSerializer::add(key, bool) overload
Without this, bools will get implicitly converted to integers, which is
usually not what we want.
2020-02-08 02:48:27 +01:00
Andreas Kling
a7e72f78cd AK: Make PrintfImplementation treat %lld as 64-bit 2020-02-08 01:43:05 +01:00
Andreas Kling
28a5e33134 AK: Add LogStream overloads for long and long long 2020-02-08 01:41:43 +01:00
Andreas Kling
9afda55d73 AK: Add some missing "inline" keywords in JsonObject.h 2020-02-06 19:32:17 +01:00
Andreas Kling
939a605334 AK: Add missing StdLibExtras.h include in Optional.h 2020-02-06 11:55:19 +01:00
Andreas Kling
0cff25ac78 AK+IPCCompiler: Get rid of BufferStream overloads for size_t
Since BufferStream is about creating specific binary stream formats,
let's not have a flaky type like size_t in there. Instead, clients of
BufferStream can cast their size_t to the binary size they want to use.

Account for this in IPCCompiler by making String lengths always 32-bit.
2020-02-05 19:13:44 +01:00
Andreas Kling
be0034d2ca AK: Break LogStream::operator<< overloads into i/l/ll and u/ul/ull 2020-02-05 19:13:44 +01:00
Andreas Kling
90b1dafeff AK: Break String::number() overloads into i/l/ll and u/ul/ull
Now that we're trying to be more portable, we can't only rely on using
i32/u32 and i64/u64 since different systems have different combinations
of int/long/long long and unsigned/unsigned long/unsigned long long.
2020-02-05 19:13:44 +01:00
joshua stein
0c4c5b5eb7 AK: Support 64-bit integers in BufferStream 2020-02-05 18:39:45 +01:00