https://git.reactos.org/?p=reactos.git;a=commitdiff;h=58e402e08e57f8040429f…
commit 58e402e08e57f8040429f10e31b552de085d12f6
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Mon Aug 28 13:51:25 2017 +0000
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Sat Oct 27 18:13:44 2018 +0200
[USETUP] Simplify code.
svn path=/branches/setup_improvements/; revision=75698
---
base/setup/usetup/settings.c | 58 ++++++++++++++++++++++++--------------------
1 file changed, 32 insertions(+), 26 deletions(-)
diff --git a/base/setup/usetup/settings.c b/base/setup/usetup/settings.c
index b7482ad0e3..2866c53b18 100644
--- a/base/setup/usetup/settings.c
+++ b/base/setup/usetup/settings.c
@@ -337,6 +337,8 @@ CreateComputerTypeList(
do
{
+ BOOLEAN FoundId;
+
if (!INF_GetDataField(&Context, 1, &KeyValue))
{
/* FIXME: Handle error! */
@@ -345,21 +347,22 @@ CreateComputerTypeList(
}
DPRINT("KeyValue: %S\n", KeyValue);
- if (wcsstr(ComputerIdentifier, KeyValue))
- {
- INF_FreeData(KeyValue);
- if (!INF_GetDataField(&Context, 0, &KeyName))
- {
- /* FIXME: Handle error! */
- DPRINT("INF_GetDataField() failed\n");
- return NULL;
- }
+ FoundId = !!wcsstr(ComputerIdentifier, KeyValue);
+ INF_FreeData(KeyValue);
- DPRINT("Computer key: %S\n", KeyName);
- wcscpy(ComputerKey, KeyName);
- INF_FreeData(KeyName);
+ if (!FoundId)
+ continue;
+
+ if (!INF_GetDataField(&Context, 0, &KeyName))
+ {
+ /* FIXME: Handle error! */
+ DPRINT("INF_GetDataField() failed\n");
+ return NULL;
}
- INF_FreeData(KeyValue);
+
+ DPRINT("Computer key: %S\n", KeyName);
+ wcscpy(ComputerKey, KeyName);
+ INF_FreeData(KeyName);
} while (SetupFindNextLine(&Context, &Context));
List = CreateGenericList();
@@ -594,6 +597,8 @@ CreateDisplayDriverList(
do
{
+ BOOLEAN FoundId;
+
if (!INF_GetDataField(&Context, 1, &KeyValue))
{
/* FIXME: Handle error! */
@@ -602,21 +607,22 @@ CreateDisplayDriverList(
}
DPRINT("KeyValue: %S\n", KeyValue);
- if (wcsstr(DisplayIdentifier, KeyValue))
- {
- INF_FreeData(KeyValue);
- if (!INF_GetDataField(&Context, 0, &KeyName))
- {
- /* FIXME: Handle error! */
- DPRINT("INF_GetDataField() failed\n");
- return NULL;
- }
+ FoundId = !!wcsstr(DisplayIdentifier, KeyValue);
+ INF_FreeData(KeyValue);
- DPRINT("Display key: %S\n", KeyName);
- wcscpy(DisplayKey, KeyName);
- INF_FreeData(KeyName);
+ if (!FoundId)
+ continue;
+
+ if (!INF_GetDataField(&Context, 0, &KeyName))
+ {
+ /* FIXME: Handle error! */
+ DPRINT("INF_GetDataField() failed\n");
+ return NULL;
}
- INF_FreeData(KeyValue);
+
+ DPRINT("Display key: %S\n", KeyName);
+ wcscpy(DisplayKey, KeyName);
+ INF_FreeData(KeyName);
} while (SetupFindNextLine(&Context, &Context));
List = CreateGenericList();