mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 13:49:12 +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 }
|
{ 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;
|
function stralloc(L : longint) : pchar;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -117,11 +110,37 @@ implementation
|
|||||||
GetMem (Stralloc,l);
|
GetMem (Stralloc,l);
|
||||||
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;
|
||||||
|
|
||||||
|
procedure strdispose(p : pchar);
|
||||||
|
|
||||||
|
begin
|
||||||
|
if p<>nil then
|
||||||
|
freemem(p,strlen(p)+1);
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$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
|
* Joined strings and sysutils
|
||||||
|
|
||||||
Revision 1.7 1998/08/05 08:59:53 michael
|
Revision 1.7 1998/08/05 08:59:53 michael
|
||||||
|
@ -66,23 +66,13 @@
|
|||||||
end;
|
end;
|
||||||
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$
|
$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
|
* fixed strlcat
|
||||||
|
|
||||||
Revision 1.3 1999/09/01 09:25:10 peter
|
Revision 1.3 1999/09/01 09:25:10 peter
|
||||||
|
@ -54,6 +54,23 @@ begin
|
|||||||
end;
|
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 }
|
{ StrPCopy copies the pascal string Source to Dest and returns Dest }
|
||||||
|
|
||||||
function StrPCopy(Dest: PChar; Source: string): PChar;
|
function StrPCopy(Dest: PChar; Source: string): PChar;
|
||||||
@ -101,7 +118,11 @@ end ;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$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
|
* truncated log
|
||||||
|
|
||||||
Revision 1.6 1999/08/24 13:14:50 peter
|
Revision 1.6 1999/08/24 13:14:50 peter
|
||||||
|
Loading…
Reference in New Issue
Block a user