From 8fba43609d2e6a3a8fc65690f06ffda024d36752 Mon Sep 17 00:00:00 2001 From: yury Date: Mon, 5 Nov 2018 14:00:51 +0000 Subject: [PATCH] + Added overloaded version of stringdup() for ansistring to allow stringdup to be inlined. git-svn-id: trunk@40221 - --- compiler/cutils.pas | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/compiler/cutils.pas b/compiler/cutils.pas index dca1fd43d7..811617887b 100644 --- a/compiler/cutils.pas +++ b/compiler/cutils.pas @@ -144,7 +144,8 @@ interface { allocates mem for a copy of s, copies s to this mem and returns } { a pointer to this mem } - function stringdup(const s : string) : pshortstring;{$ifdef USEINLINE}inline;{$endif} + function stringdup(const s : shortstring) : pshortstring;{$ifdef USEINLINE}inline;{$endif} + function stringdup(const s : ansistring) : pshortstring;{$ifdef USEINLINE}inline;{$endif} {# Allocates memory for the string @var(s) and copies s as zero terminated string to that allocated memory and returns a pointer @@ -1221,13 +1222,19 @@ implementation end; - function stringdup(const s : string) : pshortstring;{$ifdef USEINLINE}inline;{$endif} + function stringdup(const s : shortstring) : pshortstring;{$ifdef USEINLINE}inline;{$endif} begin getmem(result,length(s)+1); result^:=s; end; + function stringdup(const s : ansistring) : pshortstring;{$ifdef USEINLINE}inline;{$endif} + begin + getmem(result,length(s)+1); + result^:=s; + end; + function CompareStr(const S1, S2: string): Integer; var count, count1, count2: integer;