home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / amiga / programm / 18069 < prev    next >
Encoding:
Internet Message Format  |  1993-01-03  |  2.0 KB

  1. Path: sparky!uunet!mcsun!fuug!funic!sauna.cs.hut.fi!news.cs.hut.fi!s37732v
  2. From: s37732v@snakemail.hut.fi (Markus Juhani Aalto)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: AllocRemember - how does it work?
  5. Date: 03 Jan 93 10:23:45 GMT
  6. Organization: Helsinki University of Technology, Finland
  7. Lines: 38
  8. Distribution: inet
  9. Message-ID: <S37732V.93Jan3122345@lk-hp-18.hut.fi>
  10. References: <d2hacker.724952539@dtek.chalmers.se> <1i5rpcINNj4j@agate.berkeley.edu>
  11. NNTP-Posting-Host: lk-hp-18.hut.fi
  12. In-reply-to: cliffwd@soda.berkeley.edu's message of 3 Jan 1993 04:58:20 GMT
  13.  
  14. In article <1i5rpcINNj4j@agate.berkeley.edu> cliffwd@soda.berkeley.edu (Cliff Draper) writes:
  15.  
  16.    The AutoDocs describe this Intuition command.  But if your AutoDocs arn't
  17.    handy....
  18.  
  19.    struct Remember  *remkey=NULL;
  20.  
  21.    char  *block1, *block2;
  22.  
  23.    if (!(block1=(char *) AllocRemember(&remkey, BLOCK1SIZE, MEMF_CLEAR)))
  24.       fail("insufficient memory");
  25.    if (!(block2=(char *) AllocRemember(&remkey, BLOCK2SIZE, MEMF_CLEAR)))
  26.       fail("insufficient memory");
  27.    /* use the 2 blocks as if you got them from AllocMem() */
  28.    fail("all done");
  29.    ...
  30.    /* and within fail() */
  31.    FreeRemember(*remkey, TRUE);
  32.  
  33.    You might also need some includes, but there's the bones.
  34.    fail() can be called before, in-between, or after the AllocRember()'s and 
  35.    all memory allocated through that one key will be released.
  36.  
  37.    -Cliff
  38.  
  39. FreeRemember should propably be FreeRemember(remkey,TRUE);
  40.  
  41. --
  42.  
  43.  
  44. **************************************************************************
  45. *         Markus Aalto              | Helsinki University of Technology  *
  46. *                                   |                                    *
  47. *  EMail: s37732v@vipunen.hut.fi    | Faculty of Electric Engineering    *
  48. *  Fax:   358-0-8746991 (Sometimes) |                                    *
  49. *                                   | Undergraduate in Computer Science  *
  50. **************************************************************************
  51.         
  52.