mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 09:59:25 +02:00
* strnew is ofcourse also different between sysutils and strings, just
like stralloc/strdispose.
This commit is contained in:
parent
ddbb8aea45
commit
b1ce2dee62
@ -103,13 +103,6 @@ implementation
|
||||
|
||||
{ Functions, different from the one in sysutils }
|
||||
|
||||
procedure strdispose(p : pchar);
|
||||
|
||||
begin
|
||||
if p<>nil then
|
||||
freemem(p,strlen(p)+1);
|
||||
end;
|
||||
|
||||
function stralloc(L : longint) : pchar;
|
||||
|
||||
begin
|
||||
@ -117,11 +110,37 @@ implementation
|
||||
GetMem (Stralloc,l);
|
||||
end;
|
||||
|
||||
function strnew(p : pchar) : pchar;
|
||||
|
||||
var
|
||||
len : longint;
|
||||
|
||||
begin
|
||||
strnew:=nil;
|
||||
if (p=nil) or (p^=#0) then
|
||||
exit;
|
||||
len:=strlen(p)+1;
|
||||
getmem(strnew,len);
|
||||
if strnew<>nil then
|
||||
strmove(strnew,p,len);
|
||||
end;
|
||||
|
||||
procedure strdispose(p : pchar);
|
||||
|
||||
begin
|
||||
if p<>nil then
|
||||
freemem(p,strlen(p)+1);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 1999-02-25 07:42:03 michael
|
||||
Revision 1.2 1999-12-10 15:02:12 peter
|
||||
* strnew is ofcourse also different between sysutils and strings, just
|
||||
like stralloc/strdispose.
|
||||
|
||||
Revision 1.1 1999/02/25 07:42:03 michael
|
||||
* Joined strings and sysutils
|
||||
|
||||
Revision 1.7 1998/08/05 08:59:53 michael
|
||||
|
@ -66,23 +66,13 @@
|
||||
end;
|
||||
end;
|
||||
|
||||
function strnew(p : pchar) : pchar;
|
||||
|
||||
var
|
||||
len : longint;
|
||||
|
||||
begin
|
||||
strnew:=nil;
|
||||
if (p=nil) or (p^=#0) then
|
||||
exit;
|
||||
len:=strlen(p)+1;
|
||||
getmem(strnew,len);
|
||||
if strnew<>nil then
|
||||
strmove(strnew,p,len);
|
||||
end;
|
||||
{
|
||||
$Log$
|
||||
Revision 1.4 1999-09-13 11:42:42 peter
|
||||
Revision 1.5 1999-12-10 15:02:12 peter
|
||||
* strnew is ofcourse also different between sysutils and strings, just
|
||||
like stralloc/strdispose.
|
||||
|
||||
Revision 1.4 1999/09/13 11:42:42 peter
|
||||
* fixed strlcat
|
||||
|
||||
Revision 1.3 1999/09/01 09:25:10 peter
|
||||
|
@ -54,6 +54,23 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
{ Allocates a new string using StrAlloc, you need StrDispose to dispose the
|
||||
string }
|
||||
|
||||
function strnew(p : pchar) : pchar;
|
||||
var
|
||||
len : longint;
|
||||
begin
|
||||
strnew:=nil;
|
||||
if (p=nil) or (p^=#0) then
|
||||
exit;
|
||||
len:=strlen(p)+1;
|
||||
StrNew:=StrAlloc(Len);
|
||||
if strnew<>nil then
|
||||
strmove(strnew,p,len);
|
||||
end;
|
||||
|
||||
|
||||
{ StrPCopy copies the pascal string Source to Dest and returns Dest }
|
||||
|
||||
function StrPCopy(Dest: PChar; Source: string): PChar;
|
||||
@ -101,7 +118,11 @@ end ;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.7 1999-11-06 14:41:31 peter
|
||||
Revision 1.8 1999-12-10 15:02:12 peter
|
||||
* strnew is ofcourse also different between sysutils and strings, just
|
||||
like stralloc/strdispose.
|
||||
|
||||
Revision 1.7 1999/11/06 14:41:31 peter
|
||||
* truncated log
|
||||
|
||||
Revision 1.6 1999/08/24 13:14:50 peter
|
||||
|
Loading…
Reference in New Issue
Block a user