home *** CD-ROM | disk | FTP | other *** search
-
- (*
- * varstr.inc - Library to manipulate variable-allocation strings.
- *
- * (C) 1987 Samuel H. Smith, 18-Oct-87 (rev. 18-Oct-87)
- *
- *)
-
- procedure releasestr( var str: varstring);
- (* release the memory used by a varstring variable. variable MUST
- be pre-allocated or the program may crash!!! *)
- begin
- if str <> nil then
- begin
- freemem(str,length(str^)+1);
- str := nil;
- end;
- end;
-
-
- procedure savestr( var tostr: varstring;
- from: longstring);
- (* save a regular string in a varstring; new allocation of varstring *)
- begin
- releasestr(tostr);
- getmem(tostr, length(from)+1);
- tostr^ := from;
- end;
-
-
-