[PATCH 1/2] cmd: Use terminated strings in WCMD_ReadAndParseLine()

Hugh McMaster hugh.mcmaster at outlook.com
Wed Apr 14 00:21:39 CDT 2021


On Wed, 14 Apr 2021 at 00:17, Gijs Vermeulen wrote:
> Not sure if it matters much, but isn't using lstrlenW() going to be more expensive than using ARRAY_SIZE() for the same thing?

While the sizeof() calculations in the ARRAY_SIZE() macro occur at
compile-time (meaning no cost), lstrlenW() and friends are highly
optimized for speed. Some implementations of strlen() are even written
in assembly for even more speed.

Given the string lengths being checked seem to be <= 5, any cost is
extremely minimal at best.

I'm not sure if anyone else has any thoughts on this, but I still
think calculating string length in WCMD_keyword_ws_found() will work
better.



More information about the wine-devel mailing list