home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
- # include "strings.h"
-
- procedure disposeS{(var s: String)};
- {
- * reclaims the storage associated with the string s
- }
- var t, next: stringtail;
- begin
- if s = nil then { -- Do nothing } else
- if s^.REFS < 2 then begin { -- Only ref. to this string }
- t := s^.TAIL;
- dispose(s); s := nil; { -- emptyS }
- while t <> nil do begin
- next := t^.REST;
- dispose(t);
- t := next
- end
- end
- else begin
- { -- Decrement the references count, and make s = the empty string }
- with s^ do REFS := REFS-1;
- s := nil
- end
- end{ -- disposeS};
-