mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 09:29:26 +02:00
* fixed argument copying
This commit is contained in:
parent
a657c82a59
commit
c435d32c97
@ -731,17 +731,21 @@ var
|
|||||||
argvlen : longint;
|
argvlen : longint;
|
||||||
|
|
||||||
procedure allocarg(idx,len:longint);
|
procedure allocarg(idx,len:longint);
|
||||||
begin
|
var
|
||||||
if idx>=argvlen then
|
oldargvlen : longint;
|
||||||
begin
|
begin
|
||||||
argvlen:=(idx+8) and (not 7);
|
oldargvlen:=argvlen;
|
||||||
sysreallocmem(argv,argvlen*sizeof(pointer));
|
if idx>=argvlen then
|
||||||
end;
|
begin
|
||||||
{ use realloc to reuse already existing memory }
|
argvlen:=(idx+8) and (not 7);
|
||||||
{ always allocate, even if length is zero, since }
|
sysreallocmem(argv,argvlen*sizeof(pointer));
|
||||||
{ the arg. is still present! }
|
fillchar(argv[oldargvlen],(argvlen-oldargvlen)*sizeof(pointer),0);
|
||||||
sysreallocmem(argv[idx],len+1);
|
end;
|
||||||
end;
|
{ use realloc to reuse already existing memory }
|
||||||
|
{ always allocate, even if length is zero, since }
|
||||||
|
{ the arg. is still present! }
|
||||||
|
sysreallocmem(argv[idx],len+1);
|
||||||
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
{ create commandline, it starts with the executed filename which is argv[0] }
|
{ create commandline, it starts with the executed filename which is argv[0] }
|
||||||
@ -1621,7 +1625,10 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.58 2004-06-20 09:24:40 peter
|
Revision 1.59 2004-06-26 15:05:14 florian
|
||||||
|
* fixed argument copying
|
||||||
|
|
||||||
|
Revision 1.58 2004/06/20 09:24:40 peter
|
||||||
fixed go32v2 compile
|
fixed go32v2 compile
|
||||||
|
|
||||||
Revision 1.57 2004/06/17 16:16:14 peter
|
Revision 1.57 2004/06/17 16:16:14 peter
|
||||||
@ -1732,4 +1739,4 @@ end.
|
|||||||
Revision 1.23 2002/01/25 16:23:03 peter
|
Revision 1.23 2002/01/25 16:23:03 peter
|
||||||
* merged filesearch() fix
|
* merged filesearch() fix
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user