Bläddra i källkod

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

git-svn-id: trunk@33490 -
florian 9 år sedan
förälder
incheckning
2b082d88a6
1 ändrade filer med 3 tillägg och 5 borttagningar
  1. 3 5
      rtl/inc/generic.inc

+ 3 - 5
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}