* generic implementation of fpc_pchar_length uses IndexByte instead of a simple while loop

git-svn-id: trunk@33490 -
This commit is contained in:
florian 2016-04-12 18:11:27 +00:00
parent 9dae10b8ba
commit 2b082d88a6

View File

@ -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}