From 2d655a487ecb8eb0b981f777ef0195a83bfd47c3 Mon Sep 17 00:00:00 2001 From: Serge Gautherie <32623169+SergeGautherie@users.noreply.github.com> Date: Tue, 22 Oct 2024 20:44:27 +0200 Subject: [PATCH] [MORE] PagePrompt(): Optimize check to load string resources (#7476) It is useless to check each string individually and to try to load them again. Use a common flag instead. Follow-up to 2dbbfe8 (0.4.15-dev-2691). --- base/applications/cmdutils/more/more.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/base/applications/cmdutils/more/more.c b/base/applications/cmdutils/more/more.c index df9f18b814a..d10b001ebd8 100644 --- a/base/applications/cmdutils/more/more.c +++ b/base/applications/cmdutils/more/more.c @@ -176,19 +176,20 @@ PagePrompt(PCON_PAGER Pager, DWORD Done, DWORD Total) static WCHAR StrLineAt[80] = L""; static WCHAR StrOptions[80] = L""; static WCHAR StrLines[80] = L""; + static BOOL AreStrLoaded = FALSE; WCHAR szPercent[80] = L""; WCHAR szLineAt[80] = L""; /* Load the prompt strings */ - if (!*StrPercent) + if (!AreStrLoaded) + { K32LoadStringW(NULL, IDS_CONTINUE_PERCENT, StrPercent, ARRAYSIZE(StrPercent)); - if (!*StrLineAt) K32LoadStringW(NULL, IDS_CONTINUE_LINE_AT, StrLineAt, ARRAYSIZE(StrLineAt)); - if (!*StrOptions) K32LoadStringW(NULL, IDS_CONTINUE_OPTIONS, StrOptions, ARRAYSIZE(StrOptions)); - if (!*StrLines) K32LoadStringW(NULL, IDS_CONTINUE_LINES, StrLines, ARRAYSIZE(StrLines)); + AreStrLoaded = TRUE; + } /* * Check whether the pager is prompting, but we have actually finished