From 2b082d88a6bd845434550d626f9d1ffec476be38 Mon Sep 17 00:00:00 2001 From: florian Date: Tue, 12 Apr 2016 18:11:27 +0000 Subject: [PATCH] * generic implementation of fpc_pchar_length uses IndexByte instead of a simple while loop git-svn-id: trunk@33490 - --- rtl/inc/generic.inc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/rtl/inc/generic.inc b/rtl/inc/generic.inc index 8b6ec25806..aa422bb090 100644 --- a/rtl/inc/generic.inc +++ b/rtl/inc/generic.inc @@ -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}