https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b2cac5cd6ca3c0491c47a…
commit b2cac5cd6ca3c0491c47ab551de00e75b87ca2c1
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Mon Feb 20 18:31:34 2023 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Mon Feb 20 18:31:34 2023 +0900
[USETUP] Slightly optimize CONSOLE_SetStyledText (#5087)
Do not calculate Length unless necessary. CORE-18838
---
base/setup/usetup/consup.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/base/setup/usetup/consup.c b/base/setup/usetup/consup.c
index 22feebd7c79..15e0fa69d99 100644
--- a/base/setup/usetup/consup.c
+++ b/base/setup/usetup/consup.c
@@ -675,13 +675,10 @@ CONSOLE_SetStyledText(
IN LPCSTR Text)
{
COORD coPos;
- DWORD Length;
coPos.X = x;
coPos.Y = y;
- Length = (ULONG)strlen(Text);
-
if (Flags & TEXT_TYPE_STATUS)
{
coPos.X = x;
@@ -695,11 +692,11 @@ CONSOLE_SetStyledText(
if (Flags & TEXT_ALIGN_CENTER)
{
- coPos.X = (xScreen - Length) / 2;
+ coPos.X = (xScreen - (SHORT)strlen(Text)) / 2;
}
else if(Flags & TEXT_ALIGN_RIGHT)
{
- coPos.X = coPos.X - Length;
+ coPos.X = coPos.X - (SHORT)strlen(Text);
if (Flags & TEXT_PADDING_SMALL)
{