summaryrefslogtreecommitdiff
path: root/rtl/inc/cgeneric.inc
diff options
context:
space:
mode:
authorjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2009-01-01 22:02:17 +0000
committerjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2009-01-01 22:02:17 +0000
commit8d05304cb20572aca445e8711b417b14cb5243ca (patch)
treee9fdd44c9115ad6e823ff1482e3bfa0678956ca1 /rtl/inc/cgeneric.inc
parentd1369ce0116aaa8d29e3059f7cd743ba2c068a0c (diff)
downloadfpc-8d05304cb20572aca445e8711b417b14cb5243ca.tar.gz
* return 0 for length(pchar(0)), like Kylix does (using corrected and
multi-platform version of patch in r12461, which caused the i386 version of fpc_pchar_length to return 0 in all cases, which used tabs, and did not include a test case) git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@12464 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'rtl/inc/cgeneric.inc')
-rw-r--r--rtl/inc/cgeneric.inc5
1 files changed, 4 insertions, 1 deletions
diff --git a/rtl/inc/cgeneric.inc b/rtl/inc/cgeneric.inc
index 981b98f5ea..0647e92128 100644
--- a/rtl/inc/cgeneric.inc
+++ b/rtl/inc/cgeneric.inc
@@ -112,7 +112,10 @@ function libc_pchar_length(p:pchar):size_t; cdecl; external 'c' name 'strlen';
function fpc_pchar_length(p:pchar):longint;[public,alias:'FPC_PCHAR_LENGTH']; compilerproc;
begin
- fpc_pchar_length:=libc_pchar_length(p);
+ if assigned(p) then
+ fpc_pchar_length:=libc_pchar_length(p)
+ else
+ fpc_pchar_length:=0;
end;
{$endif ndef FPC_SYSTEM_HAS_FPC_PCHAR_LENGTH}