Commit Graph

73 Commits

Author SHA1 Message Date
0126a8fb6e
luna: Add a new SourceLocation class and use that in check() and expect() 2023-01-22 11:43:48 +01:00
129297a0b0
CString: Fix compilation in strnlen() 2023-01-22 11:43:10 +01:00
cf8d3c6ff9
OwnedStringView: Add a method to extract a substring
Some checks failed
continuous-integration/drone/push Build is failing
2023-01-22 11:27:54 +01:00
12d2039f68
CString: Add strnlen() and strndup() 2023-01-22 11:27:37 +01:00
944d32de36
Bitmap: Introduce new malloc-aware initialization functions
All checks were successful
continuous-integration/drone/push Build is passing
Lets us call resize(new_size) instead of initialize(realloc(location, new_size), new_size)
2023-01-21 23:16:50 +01:00
0e607c2fef
Bitmap: Declare more variables as const
I miss Rust's immutability-by-default...
2023-01-21 23:04:21 +01:00
a3d0fa7d0a
UserVM: Validate the entire range when freeing multiple VM pages
All checks were successful
continuous-integration/drone/push Build is passing
2023-01-16 21:16:38 +01:00
329e8ab182
luna/Heap: Scrub reallocations properly 2023-01-16 19:50:35 +01:00
d0600f5714
luna: Make Utf8StringEncoder short-circuit instead of failing when hitting the length limit
All checks were successful
continuous-integration/drone/push Build is passing
2023-01-14 12:07:08 +01:00
00ee8314b3
luna: Make Utf8String{De,En}coders return the number of bytes written
This means we can avoid a call to code_points() in mbstowcs(),
which would parse a string twice.
2023-01-14 11:55:19 +01:00
2d2db300b0
libc: Add malloc(), calloc(), realloc() and free()
All checks were successful
continuous-integration/drone/push Build is passing
2023-01-13 20:00:20 +01:00
5fb2ff09c7
kernel, luna, libc: Move the heap code to a common zone, to be used by both kernel and userspace 2023-01-13 19:27:53 +01:00
09dc8bd522
Bitmap: Add find_region() and find_and_toggle_region() 2023-01-13 18:55:31 +01:00
59db656f25
size_t -> usize 2023-01-13 18:55:05 +01:00
d150c55143
TarStream: Support mode
All checks were successful
continuous-integration/drone/push Build is passing
2023-01-11 18:42:50 +01:00
82b555cf5c
TarStream: Refactor the API to get rid of that awful method in Result
All checks were successful
continuous-integration/drone/push Build is passing
That method being try_set_value_with_specific_error()
2023-01-11 17:30:53 +01:00
84c82a4e75
luna, kernel: More constness
All checks were successful
continuous-integration/drone/push Build is passing
2023-01-10 19:31:41 +01:00
5aa667c776
luna: Make OwnedStringView::clone() just call from_string_literal()
All checks were successful
continuous-integration/drone/push Build is passing
2023-01-10 19:03:00 +01:00
3ac3d54788
luna: Make check() and expect() output errors in userspace 2023-01-10 19:02:16 +01:00
c83f6c03b5
Bitmap: Add a 'find_and_toggle' method
All checks were successful
continuous-integration/drone/push Build is passing
Just like find(), but toggles the value when finding it.
Avoids doing this manually in MemoryManager and KernelVM.
2023-01-09 18:08:50 +01:00
4287ec6cb0
Bitmap: Introduce a new method 'find' and use it in MM and KernelVM
All checks were successful
continuous-integration/drone/push Build is passing
This method looks for the first bit with a value, optionally from a starting index, and returns its index.
This should be (haven't benchmarked) way faster than the manual way,
AKA what MM and KernelVM were doing.

This is due to this method using bit and byte manipulation tricks instead of just calling get() until getting the desired result :)
2023-01-09 17:59:52 +01:00
b851dcf9b9
libc: Implement mbstowcs() using Utf8StringDecoder
Some checks failed
continuous-integration/drone/push Build is failing
2023-01-06 21:01:37 +01:00
80f5c790f8
Implement string formatting into libc :)
All checks were successful
continuous-integration/drone/push Build is passing
Of course, using <luna/Format.h> makes it so simple. No need for duplicate code!
2023-01-06 20:15:43 +01:00
a01b56ed39
CString: Support strcpy(), strcat() and strchr() 2023-01-06 16:20:35 +01:00
b27cefb9c5
SystemError: Define _LUNA_SYSTEM_ERROR_EXTENSIONS to compile properly in hosted envs 2023-01-06 13:30:49 +01:00
5854e5e530
Add newlines at end-of-file 2023-01-02 13:07:29 +01:00
f71ccde833
Add an overload for aligned deletes which just calls the normal operator delete 2022-12-24 11:49:12 +01:00
e5ae2b0435
TarStream: Make read_contents and friends const 2022-12-23 13:08:31 +01:00
c39e54b7c6
Make TarStream::read_contents take any pointer as output 2022-12-23 10:51:55 +01:00
9afaad8fed
Add dbgln() for the luna library
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-22 18:00:35 +01:00
a3595e71a9
Update .clang-format
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-21 20:22:44 +01:00
96135ff808
Use limits.h for the standard definition of WCHAR_MAX
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-21 20:11:00 +01:00
16bf8b38ea
UTF-8 decoder: Error out on overlong encodings
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-21 20:08:43 +01:00
31ee901e01
TarStream: Add a variant of read_contents() returning an OwnedStringView 2022-12-19 12:21:17 +01:00
9eb829f3a2
CString: Add strcmp() 2022-12-19 12:20:56 +01:00
00cf267ac7
Lock EFIXME and error_string() behind a #define
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-18 18:14:48 +01:00
a08310ff5e
Add some more errno definitions
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-18 18:09:52 +01:00
4a7e48ed5d
Make sure wchar_t is wide enough to hold all Unicode code-points
All checks were successful
continuous-integration/drone/push Build is passing
Too bad if it isn't.
2022-12-18 17:14:12 +01:00
1d6092341a
Add a generic TarStream class
As long as it's in memory, we can use it :)
2022-12-18 16:38:47 +01:00
eadca3d25b
Add nullcpy()
Invented function to memcpy() with a specific size, but add a null terminator.
2022-12-18 16:31:02 +01:00
6389099808
UTF-8 part 2: Encoding wide-character strings into UTF-8
All checks were successful
continuous-integration/drone/push Build is passing
We now have Utf8StringEncoder and Utf8Encoder (no state this time)
2022-12-18 14:34:50 +01:00
9c1c6bb320
Add wcslen()
I think this can go in CString.h, no need to create a separate CWChar.h or something
2022-12-18 14:33:13 +01:00
75ba14a3ad
Add UTF-8 decoder support!! 2022-12-18 13:04:40 +01:00
ee6387e7b5
Refactor NumberParsing.cpp + a lot of comments 2022-12-17 15:00:19 +01:00
97cb57d521
Check for overflow/underflow in parse_signed_integer
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-17 14:42:56 +01:00
16954695dd
Tell the compiler that string_format is a printf-style function
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-17 12:45:26 +01:00
abbed13f27
Add a 'pure' variant of cstyle_format which is infallible
If we cannot fail to output, it doesn't make sense to propagate errors. So if you're SURE there are no errors, use pure_cstyle_format().
If, however, output can fail, use cstyle_format().

This has a drawback of adding quite a bit of code duplication to Format.cpp.
Some of it is dealt using templates, but some code still remains duplicate.
2022-12-17 12:38:22 +01:00
48fcb8734a
Give number parsing functions more meaningful names 2022-12-17 12:12:58 +01:00
cf3b2176f0
Implement OwnedStringView::from_string_literal
All checks were successful
continuous-integration/drone/push Build is passing
2022-12-17 11:36:16 +01:00
da39ba33a9
Move OwnedStringView::operator[] out of line 2022-12-16 20:48:58 +01:00