+ Fix for assign of null string

This commit is contained in:
michael 1998-11-02 09:46:12 +00:00
parent 26affab4c5
commit 9a38bce562

View File

@ -123,22 +123,15 @@ Procedure Decr_Ansi_Ref (Var S : Pointer);
Type plongint = ^longint; Type plongint = ^longint;
Var l : plongint; Var l : plongint;
Begin Begin
// dumpansirec(s);
{ Zero string } { Zero string }
If S=Nil then If S=Nil then exit;
exit;
{ check for constant strings ...} { check for constant strings ...}
l:=S-FirstOff+8; l:=@PANSIREC(S-FirstOff)^.Ref;
If l^<0 then exit; If l^<0 then exit;
Dec(l^); Dec(l^);
// dumpansirec(s);
If l^=0 then If l^=0 then
{ Ref count dropped to zero } { Ref count dropped to zero }
begin
// Writeln ('Calling disposestring');
DisposeAnsiString (S); { Remove...} DisposeAnsiString (S); { Remove...}
end
end; end;
Procedure Incr_Ansi_Ref (Var S : Pointer); Procedure Incr_Ansi_Ref (Var S : Pointer);
@ -184,6 +177,11 @@ begin
If S2<>nil then If S2<>nil then
If PAnsiRec(S2-FirstOff)^.Ref>0 then If PAnsiRec(S2-FirstOff)^.Ref>0 then
Inc(PAnsiRec(S2-FirstOff)^.ref); Inc(PAnsiRec(S2-FirstOff)^.ref);
Temp:=S2;
end;
end
else
temp:=S2;
{ Decrease the reference count on the old S1 } { Decrease the reference count on the old S1 }
Decr_Ansi_Ref (S1); Decr_Ansi_Ref (S1);
{ And finally, have S1 pointing to S2 (or its copy) } { And finally, have S1 pointing to S2 (or its copy) }
@ -704,7 +702,10 @@ end;
{ {
$Log$ $Log$
Revision 1.25 1998-10-30 21:42:48 michael Revision 1.26 1998-11-02 09:46:12 michael
+ Fix for assign of null string
Revision 1.25 1998/10/30 21:42:48 michael
Fixed assignment of NIL string. Fixed assignment of NIL string.
Revision 1.24 1998/10/22 11:32:23 michael Revision 1.24 1998/10/22 11:32:23 michael