mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-17 23:19:29 +02:00
* avoid wrong warning about FillChar not initializing the output parameter in case count <= 0
This commit is contained in:
parent
4c330f2799
commit
9bb6a32c62
@ -39,8 +39,11 @@ procedure memset(var x; value: byte; count: size_t); cdecl; external clib;
|
||||
|
||||
Procedure FillChar(var x;count: sizeint;value:byte);{$ifdef SYSTEMINLINE}inline;{$endif}
|
||||
begin
|
||||
if count <= 0 then
|
||||
exit;
|
||||
{ don't exit if count is <= 0, this makes the compiler think x is uninitialized,
|
||||
as FillChar is probably rarely called with count <= 0, the performance hit is
|
||||
probably neglible }
|
||||
if count < 0 then
|
||||
count := 0;
|
||||
memset(x,value,size_t(count));
|
||||
end;
|
||||
{$endif FPC_SYSTEM_HAS_FILLCHAR}
|
||||
|
Loading…
Reference in New Issue
Block a user