mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-16 01:39:27 +02:00
* generic implementation of fpc_pchar_length uses IndexByte instead of a simple while loop
git-svn-id: trunk@33490 -
This commit is contained in:
parent
9dae10b8ba
commit
2b082d88a6
@ -1272,13 +1272,11 @@ end;
|
||||
{$ifndef FPC_SYSTEM_HAS_FPC_PCHAR_LENGTH}
|
||||
|
||||
function fpc_pchar_length(p:pchar):sizeint;[public,alias:'FPC_PCHAR_LENGTH']; compilerproc;
|
||||
var i : sizeint;
|
||||
begin
|
||||
i:=0;
|
||||
if assigned(p) then
|
||||
while p[i]<>#0 do
|
||||
inc(i);
|
||||
exit(i);
|
||||
Result:=IndexByte(p^,high(Result),0)
|
||||
else
|
||||
Result:=0;
|
||||
end;
|
||||
|
||||
{$endif ndef FPC_SYSTEM_HAS_FPC_PCHAR_LENGTH}
|
||||
|
Loading…
Reference in New Issue
Block a user