[PATCH] cryptui: Avoid calling strlen on a constant.

Michael Stefaniuc mstefani at winehq.org
Tue Feb 5 12:14:11 CST 2019


On 2/5/19 9:02 AM, Isira Seneviratne wrote:
> 
> 
> On Tue, Feb 5, 2019 at 1:26 PM Nikolay Sivov <nsivov at codeweavers.com
> <mailto:nsivov at codeweavers.com>> wrote:
> 
>     I don't think hardcoded sizes like that are better, because you'll
>     always need to double check with actual string.
> 
> What is there to double check, though? It seems to be fairly straight
> forward.
Magic constants are bad, one has to follow the code flow to figure it
out. Afair we even had a janitorial task to remove magic constants.

If you still want to get rid of the strlen do it like Alex Henri did and
use: ARRAY_SIZE(wstr) - 1.

bye
	michael




More information about the wine-devel mailing list