[Contents] [index] [Help] [Retrace] [browse <] [Browse >]

The memlist created by allocentry() contains mementry entries.  mementrys
are defined by a union statement, which allows one memory space to be
defined in more than one way.

If allocentry() returns a value with bit 31 clear, then all of the
meu_addr positions in the returned memlist will contain valid memory
addresses meeting the requirements you have provided.  To use this memory
area, you would use code similar to the following:

    #define ALLOCERROR 0x80000000
    struct  MemList *ml;
    APTR    data, moredata;

    if ( ! ((ULONG)ml & ALLOCERROR)))    /* After calling AllocEntry to */
                                         /* allocate ml */
    {
        data     = ml->ml_ME[0].me_Addr;
        moredata = ml->ml_ME[1].me_Addr;
    }
    else  exit(200);                     /* error during AllocEntry */

If allocentry() has problems while trying to allocate the memory you have
requested, instead of the address of a new memlist, it will return the
memory requirements value with which it had the problem.  Bit 31 of the
value returned will be set, and no memory will be allocated.  Entries in
the list that were already allocated will be freed.  For example, a failed
allocation of cleared Chip memory (memf_clear | memf_chip) could be
indicated with 0x80010002, where bit 31 indicates failure, bit 16 is the
MEMF_CLEAR flag and bit 1 is the MEMF_CHIP flag.