From b41738b47bcd4d9b4a9436349e32f776a3fbef4c Mon Sep 17 00:00:00 2001 From: Bananymous Date: Sat, 14 Sep 2024 19:39:13 +0300 Subject: [PATCH] Kernel: Fix ACPI name formatting functions --- kernel/include/kernel/ACPI/AML/Names.h | 39 ++++++++++++++------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/kernel/include/kernel/ACPI/AML/Names.h b/kernel/include/kernel/ACPI/AML/Names.h index 94a015fe34..4041c0e725 100644 --- a/kernel/include/kernel/ACPI/AML/Names.h +++ b/kernel/include/kernel/ACPI/AML/Names.h @@ -215,26 +215,29 @@ namespace BAN } }; - template - void Formatter::print_argument(F putc, const Kernel::ACPI::AML::NameSeg& name_seg, const ValueFormat&) + namespace Formatter { - size_t len = 4; - while (len > 0 && name_seg.chars[len - 1] == '_') - len--; - for (size_t i = 0; i < len; i++) - putc(name_seg.chars[i]); - } - - template - void Formatter::print_argument(F putc, const Kernel::ACPI::AML::NameString& name_string, const ValueFormat&) - { - print_argument(putc, name_string.prefix, {}); - if (!name_string.path.empty()) - print_argument(putc, name_string.path.front(), {}); - for (size_t i = 1; i < name_string.path.size(); i++) + template + void print_argument(F putc, const Kernel::ACPI::AML::NameSeg& name_seg, const ValueFormat&) { - putc('.'); - print_argument(putc, name_string.path[i], {}); + size_t len = 4; + while (len > 0 && name_seg.chars[len - 1] == '_') + len--; + for (size_t i = 0; i < len; i++) + putc(name_seg.chars[i]); + } + + template + void print_argument(F putc, const Kernel::ACPI::AML::NameString& name_string, const ValueFormat&) + { + print_argument(putc, name_string.prefix, {}); + if (!name_string.path.empty()) + print_argument(putc, name_string.path.front(), {}); + for (size_t i = 1; i < name_string.path.size(); i++) + { + putc('.'); + print_argument(putc, name_string.path[i], {}); + } } }