mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:37:35 +00:00
AK: Remove the ctype adapters and use the actual ctype functions instead
This finally takes care of the kind-of excessive boilerplate code that were the ctype adapters. On the other hand, I had to link `LibC/ctype.cpp` to the Kernel (for `AK/JsonParser.cpp` and `AK/Format.cpp`). The previous commit actually makes sense now: the `string.h` includes in `ctype.{h,cpp}` would require to link more LibC stuff to the Kernel when it only needs the `_ctype_` array of `ctype.cpp`, and there wasn't any string stuff used in ctype. Instead of all this I could have put static derivatives of `is_any_of()` in the concerned AK files, however that would have meant more boilerplate and workarounds; so I went for the Kernel approach.
This commit is contained in:
parent
f158cb27ea
commit
f0f6b09acb
8 changed files with 33 additions and 125 deletions
|
@ -29,6 +29,7 @@
|
|||
#include <AK/PrintfImplementation.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringBuilder.h>
|
||||
#include <ctype.h>
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -79,7 +80,7 @@ static bool parse_number(GenericLexer& lexer, size_t& value)
|
|||
|
||||
bool consumed_at_least_one = false;
|
||||
while (!lexer.is_eof()) {
|
||||
if (lexer.next_is(is_digit)) {
|
||||
if (lexer.next_is(isdigit)) {
|
||||
value *= 10;
|
||||
value += lexer.consume() - '0';
|
||||
consumed_at_least_one = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue