VirtualBox

Ignore:
Timestamp:
Jan 7, 2025 3:14:01 PM (3 weeks ago)
Author:
vboxsync
Message:

Main/src-server/UnattendedScript.cpp: Don't call Utf8Str::find() multiple times in the RT_MIN() macro expansion, Utf8Str::find() has no side effects but calling it twice is just a waste of time, bugref:3409

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/UnattendedScript.cpp

    r106061 r107471  
    754754        pszValue = rstrTmp.assign(mpUnattended->i_getHostname(), 0, mpUnattended->i_getHostname().find(".")).c_str();
    755755    else if (IS_MATCH("HOSTNAME_WITHOUT_DOMAIN_MAX_15"))
    756         pszValue = rstrTmp.assign(mpUnattended->i_getHostname(), 0, RT_MIN(mpUnattended->i_getHostname().find("."), 15)).c_str();
     756    {
     757        size_t const idxDot = mpUnattended->i_getHostname().find(".");
     758        pszValue = rstrTmp.assign(mpUnattended->i_getHostname(), 0, RT_MIN(idxDot, 15)).c_str();
     759    }
    757760    else if (IS_MATCH("HOSTNAME_DOMAIN"))
    758761        pszValue = rstrTmp.assign(mpUnattended->i_getHostname(), mpUnattended->i_getHostname().find(".") + 1).c_str();
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette