mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 21:09:27 +02:00
+ Added overloaded version of stringdup() for ansistring to allow stringdup to be inlined.
git-svn-id: trunk@40221 -
This commit is contained in:
parent
c9a7503bbb
commit
8fba43609d
@ -144,7 +144,8 @@ interface
|
|||||||
|
|
||||||
{ allocates mem for a copy of s, copies s to this mem and returns }
|
{ allocates mem for a copy of s, copies s to this mem and returns }
|
||||||
{ a pointer to this mem }
|
{ 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
|
{# Allocates memory for the string @var(s) and copies s as zero
|
||||||
terminated string to that allocated memory and returns a pointer
|
terminated string to that allocated memory and returns a pointer
|
||||||
@ -1221,13 +1222,19 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function stringdup(const s : string) : pshortstring;{$ifdef USEINLINE}inline;{$endif}
|
function stringdup(const s : shortstring) : pshortstring;{$ifdef USEINLINE}inline;{$endif}
|
||||||
begin
|
begin
|
||||||
getmem(result,length(s)+1);
|
getmem(result,length(s)+1);
|
||||||
result^:=s;
|
result^:=s;
|
||||||
end;
|
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;
|
function CompareStr(const S1, S2: string): Integer;
|
||||||
var
|
var
|
||||||
count, count1, count2: integer;
|
count, count1, count2: integer;
|
||||||
|
Loading…
Reference in New Issue
Block a user