* strnew is ofcourse also different between sysutils and strings, just

like stralloc/strdispose.
This commit is contained in:
peter 1999-12-10 15:02:12 +00:00
parent ddbb8aea45
commit b1ce2dee62
3 changed files with 54 additions and 24 deletions

View File

@ -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

View File

@ -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

View File

@ -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