refactor(kernel): remove 'foreach' macro

Signed-off-by: EnderIce2 <enderice2@protonmail.com>
This commit is contained in:
2025-03-29 22:43:07 +00:00
parent 93d897e95c
commit 8d71ed0ad5
42 changed files with 112 additions and 119 deletions

View File

@ -27,7 +27,7 @@ using namespace Tasking;
void cmd_killall(const char *args)
{
foreach (auto Proc in TaskManager->GetProcessList())
for (auto Proc : TaskManager->GetProcessList())
{
if (strcmp(Proc->Name, args) == 0)
{

View File

@ -27,7 +27,7 @@ using namespace vfs;
void cmd_lsacpi(const char *)
{
ACPI::ACPI *acpi = (ACPI::ACPI *)PowerManager->GetACPI();
foreach (auto Table in acpi->Tables)
for (auto Table : acpi->Tables)
{
printf("%#lx: %.4s [%.6s:%.8s] %d bytes\n",
(uintptr_t)Table.second,

View File

@ -26,7 +26,7 @@ void cmd_lsmod(const char *)
printf("DRIVER | ID | INIT | MEMORY\n");
foreach (auto &drv in drivers)
for (auto &drv : drivers)
{
printf("%-15s | %5ld | %s | %ld KiB\n",
drv.second.Name,

View File

@ -29,7 +29,7 @@ void cmd_lspci(const char *args)
{
if (IF_ARG("-i") || IF_ARG("--info"))
{
foreach (auto Device in PCIManager->GetDevices())
for (auto Device : PCIManager->GetDevices())
{
const char *HdrType;
switch (Device.Header->HeaderType)
@ -65,7 +65,7 @@ void cmd_lspci(const char *args)
}
}
foreach (auto Device in PCIManager->GetDevices())
for (auto Device : PCIManager->GetDevices())
{
printf("%02x:%02x.%d: %s: %s %s\n",
Device.Bus,

View File

@ -35,7 +35,7 @@ void cmd_modinfo(const char *args)
if (drivers.find(id) == drivers.end())
{
bool found = false;
foreach (auto var in drivers)
for (auto var : drivers)
{
if (strcmp(var.second.Name, args) == 0)
{
@ -70,7 +70,7 @@ void cmd_modinfo(const char *args)
printf(" Path: %s\n", drv.Path.c_str());
printf(" Used Memory: %ld KiB\n", TO_KiB(drv.vma->GetAllocatedMemorySize()));
printf(" Used IRQs:%s\n", drv.InterruptHandlers->empty() ? " none" : "");
foreach (auto var in *drv.InterruptHandlers)
for (auto var : *drv.InterruptHandlers)
{
printf(" IRQ%-2d: %#lx\n",
var.first, (uintptr_t)var.second);

View File

@ -28,6 +28,6 @@ using namespace Tasking;
void cmd_ps(const char *)
{
printf("PID Name\n");
foreach (auto p in TaskManager->GetProcessList())
for (auto p : TaskManager->GetProcessList())
printf("%d %s\n", p->ID, p->Name);
}

View File

@ -43,7 +43,7 @@ const char *TaskStateStrings[] = {
void cmd_top(const char *)
{
printf("PID Name State Priority Memory Usage CPU Usage\n");
foreach (auto Proc in TaskManager->GetProcessList())
for (auto Proc : TaskManager->GetProcessList())
{
#if defined(__amd64__)
printf("%-4d %-20s %s %d %ld KiB %ld\n",
@ -57,7 +57,7 @@ void cmd_top(const char *)
Proc->Info.UserTime + Proc->Info.KernelTime);
#endif
foreach (auto Thrd in Proc->Threads)
for (auto Thrd : Proc->Threads)
{
#if defined(__amd64__)
printf(" %-4d %-20s %s %d %ld KiB %ld\n",

View File

@ -23,7 +23,7 @@
void tree_loop(FileNode *rootNode, int depth = 0)
{
// foreach (auto Child in rootNode->GetChildren(true))
// for (auto Child : rootNode->GetChildren(true))
// {
// Display->UpdateBuffer();
// if (Child->Stat.IsType(DIRECTORY) || Child->Stat.IsType(MOUNTPOINT))