Ignore:
Timestamp:
Jul 17, 2000, 12:43:41 AM (25 years ago)
Author:
bird
Message:

Checkin of current code in the Grace brance for backup purpose.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Grace/src/win32k/misc/malloc.c

    r2511 r3834  
    1 /* $Id: malloc.c,v 1.6 2000-01-24 18:19:00 bird Exp $
     1/* $Id: malloc.c,v 1.6.4.1 2000-07-16 22:43:40 bird Exp $
    22 *
    33 * Common Heap - this forwards to the swappable heap!
     
    2828*  Global data
    2929******************************************************************************/
    30 #ifndef RING0
     30#if !defined(RING0) || defined(R3TST)
    3131    char           fInited;       /* init flag */
    3232#endif
     
    5353    if (rc != 0)
    5454        return rc;
    55     #ifdef RING3
     55    #if !defined(RING0) || defined(R3TST)
    5656        fInited = TRUE;
    5757    #endif
     
    6969void * malloc(unsigned cbSize)
    7070{
     71    #ifdef R3TST
     72    if (!fInited)
     73    {
     74        PVOID pv;
     75        if (!DosAllocMem(&pv, cbSize, PAG_WRITE | PAG_READ | PAG_COMMIT)) /* no SSToDS! */
     76            return pv;
     77        else
     78            return NULL;
     79    }
     80    #endif
    7181    return smalloc(cbSize);
    7282}
     
    8191void *realloc(void *pv, unsigned cbNew)
    8292{
     93    #ifdef R3TST
     94    if (!fInited)
     95        Int3();
     96    #endif
    8397    return srealloc(pv, cbNew);
    8498}
     
    91105void free(void *pv)
    92106{
     107    #ifdef R3TST
     108    if (!fInited) /* controlled leak! */
     109       return;
     110    #endif
    93111    sfree(pv);
    94112}
     
    154172
    155173
     174
    156175#if !defined(RING0) && defined(__IBMC__)
    157176
     
    162181int _rmem_init(void)
    163182{
    164     int rc = heapInit(CB_RES_INIT, CB_RES_MAX, CB_SWP_INIT, CB_SWP_MAX);
     183    int rc;
     184    rc = heapInit(CB_RES_INIT, CB_RES_MAX, CB_SWP_INIT, CB_SWP_MAX);
    165185    return rc;
    166186}
Note: See TracChangeset for help on using the changeset viewer.