mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-11-09 22:56:35 +00:00
Stratosphère: Simplify some for loops (#76)
Simplifies some loops by removing the need to manually calculate or re-specify the array size. Eliminates any chance of using the wrong size and less typing.
This commit is contained in:
parent
7ab9f507cb
commit
999498c0a0
3 changed files with 12 additions and 12 deletions
|
@ -151,9 +151,9 @@ int main(int argc, char **argv)
|
|||
LaunchTitle(0x0100000000000007, 3, 0, NULL);
|
||||
|
||||
bool maintenance = ShouldForceMaintenanceMode();
|
||||
for (unsigned int i = 0; i < sizeof(g_additional_launch_programs) / sizeof(g_additional_launch_programs[0]); i++) {
|
||||
if (!maintenance || std::get<bool>(g_additional_launch_programs[i])) {
|
||||
LaunchTitle(std::get<u64>(g_additional_launch_programs[i]), 3, 0, NULL);
|
||||
for (auto &launch_program : g_additional_launch_programs) {
|
||||
if (!maintenance || std::get<bool>(launch_program)) {
|
||||
LaunchTitle(std::get<u64>(launch_program), 3, 0, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@ u64 GetServiceNameLength(u64 service) {
|
|||
|
||||
/* Utilities. */
|
||||
Registration::Process *Registration::GetProcessForPid(u64 pid) {
|
||||
for (unsigned int i = 0; i < REGISTRATION_LIST_MAX_PROCESS; i++) {
|
||||
if (g_process_list[i].pid == pid) {
|
||||
return &g_process_list[i];
|
||||
for (auto &process : g_process_list) {
|
||||
if (process.pid == pid) {
|
||||
return &process;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
@ -33,10 +33,10 @@ Registration::Process *Registration::GetFreeProcess() {
|
|||
return GetProcessForPid(0);
|
||||
}
|
||||
|
||||
Registration::Service *Registration::GetService(u64 service) {
|
||||
for (unsigned int i = 0; i < REGISTRATION_LIST_MAX_SERVICE; i++) {
|
||||
if (g_service_list[i].service_name == service) {
|
||||
return &g_service_list[i];
|
||||
Registration::Service *Registration::GetService(u64 service_name) {
|
||||
for (auto &service : g_service_list) {
|
||||
if (service.service_name == service_name) {
|
||||
return &service;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
|
Loading…
Reference in a new issue