home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / amiga / programm / 18065 < prev    next >
Encoding:
Text File  |  1993-01-03  |  1.1 KB  |  35 lines

  1. Path: sparky!uunet!spool.mu.edu!agate!soda.berkeley.edu!cliffwd
  2. From: cliffwd@soda.berkeley.edu (Cliff Draper)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: AllocRemember - how does it work?
  5. Date: 3 Jan 1993 04:58:20 GMT
  6. Organization: U.C. Berkeley, CS Undergraduate Association
  7. Lines: 23
  8. Message-ID: <1i5rpcINNj4j@agate.berkeley.edu>
  9. References: <d2hacker.724952539@dtek.chalmers.se>
  10. NNTP-Posting-Host: soda.berkeley.edu
  11.  
  12.  
  13. The AutoDocs describe this Intuition command.  But if your AutoDocs arn't
  14. handy....
  15.  
  16. struct Remember  *remkey=NULL;
  17.  
  18. char  *block1, *block2;
  19.  
  20. if (!(block1=(char *) AllocRemember(&remkey, BLOCK1SIZE, MEMF_CLEAR)))
  21.    fail("insufficient memory");
  22. if (!(block2=(char *) AllocRemember(&remkey, BLOCK2SIZE, MEMF_CLEAR)))
  23.    fail("insufficient memory");
  24. /* use the 2 blocks as if you got them from AllocMem() */
  25. fail("all done");
  26. ...
  27. /* and within fail() */
  28. FreeRemember(*remkey, TRUE);
  29.  
  30. You might also need some includes, but there's the bones.
  31. fail() can be called before, in-between, or after the AllocRember()'s and 
  32. all memory allocated through that one key will be released.
  33.  
  34. -Cliff
  35.