亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? heapinit.c

?? C標準庫源代碼,能提高對C的理解,不錯的哦
?? C
?? 第 1 頁 / 共 2 頁
字號:
/***
*heapinit.c -  Initialze the heap
*
*       Copyright (c) 1989-1997, Microsoft Corporation. All rights reserved.
*
*Purpose:
*
*******************************************************************************/


#ifdef WINHEAP


#include <cruntime.h>
#include <malloc.h>
#include <winheap.h>

HANDLE _crtheap;

/*
 * Dummy definition of _amblksiz. Included primarily so the dll will build
 * without having to change crtlib.c (there is an access function for _amblksiz
 * defined in crtlib.c).
 */
unsigned int _amblksiz = BYTES_PER_PARA;


/***
*_heap_init() - Initialize the heap
*
*Purpose:
*       Setup the initial C library heap.
*
*       NOTES:
*       (1) This routine should only be called once!
*       (2) This routine must be called before any other heap requests.
*
*Entry:
*       <void>
*Exit:
*       Returns 1 if successful, 0 otherwise.
*
*Exceptions:
*       If heap cannot be initialized, the program will be terminated
*       with a fatal runtime error.
*
*******************************************************************************/

int __cdecl _heap_init (
        int mtflag
        )
{
        //  Initialize the "big-block" heap first.
        if ( (_crtheap = HeapCreate( mtflag ? 0 : HEAP_NO_SERIALIZE,
                                     BYTES_PER_PAGE, 0 )) == NULL )
            return 0;

        //  Initialize the small-block heap
        if (__sbh_heap_init() == 0)
        {
            HeapDestroy(_crtheap);
            return 0;
        }
        return 1;
}

/***
*_heap_term() - return the heap to the OS
*
*Purpose:
*
*       NOTES:
*       (1) This routine should only be called once!
*       (2) This routine must be called AFTER any other heap requests.
*
*Entry:
*       <void>
*Exit:
*       <void>
*
*Exceptions:
*
*******************************************************************************/

void __cdecl _heap_term (void)
{
    PHEADER         pHeader = __sbh_pHeaderList;
    int             cntHeader;

    //  scan through all the headers
    for (cntHeader = 0; cntHeader < __sbh_cntHeaderList; cntHeader++)
    {
        //  decommit and release the address space for the region
        VirtualFree(pHeader->pHeapData, BYTES_PER_REGION, MEM_DECOMMIT);
        VirtualFree(pHeader->pHeapData, 0, MEM_RELEASE);

        //  free the region data structure
        HeapFree(_crtheap, 0, pHeader->pRegion);

        pHeader++;
    }
    //  free the header list
    HeapFree(_crtheap, 0, __sbh_pHeaderList);

    //  destroy the large-block heap
    HeapDestroy(_crtheap);
}


#else  /* WINHEAP */


#ifdef _WIN32


#include <cruntime.h>
#include <oscalls.h>
#include <dos.h>
#include <heap.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>

/*
 * Heap descriptor
 */


struct _heap_desc_ _heap_desc = {
        &_heap_desc.sentinel,           /* pfirstdesc */
        &_heap_desc.sentinel,           /* proverdesc */
        NULL,                           /* emptylist */
        NULL,                           /* sentinel.pnextdesc */
        NULL                            /* sentinel.pblock */
        };

/*
 * Array of region structures
 * [Note: We count on the fact that this is always initialized to zero
 * by the compiler.]
 */

struct _heap_region_ _heap_regions[_HEAP_REGIONMAX];

void ** _heap_descpages;        /* linked list of pages used for descriptors */

/*
 * Control parameter locations
 */

unsigned int _heap_resetsize = 0xffffffff;

/* NOTE: Currenlty, _heap_growsize is a #define to _amblksiz */
unsigned int _heap_growsize   = _HEAP_GROWSIZE;         /* region inc size */
unsigned int _heap_regionsize = _HEAP_REGIONSIZE_L;     /* region size */
unsigned int _heap_maxregsize = _HEAP_MAXREGSIZE_L;     /* max region size */


/***
*_heap_init() - Initialize the heap
*
*Purpose:
*       Setup the initial C library heap.  All necessary memory and
*       data bases are init'd appropriately so future requests work
*       correctly.
*
*       NOTES:
*       (1) This routine should only be called once!
*       (2) This routine must be called before any other heap requests.
*
*
*Entry:
*       <void>
*Exit:
*       <void>
*
*Exceptions:
*       If heap cannot be initialized, the program will be terminated
*       with a fatal runtime error.
*
*******************************************************************************/

void __cdecl _heap_init (
        void
        )
{
        /*
         * Test for Win32S or Phar Lap TNT environment
         * which cannot allocate uncommitted memory
         * without actually allocating physical memory
         *
         * High bit of _osver is set for both of those environments
         * -AND- the Windows version will be less than 4.0.
         */

        if ( ( _osver & 0x8000 ) && ( _winmajor < 4 ) )
        {
                _heap_regionsize = _HEAP_REGIONSIZE_S;
                _heap_maxregsize = _HEAP_MAXREGSIZE_S;
        }
}



/***
*_heap_term() - Clean-up the heap
*
*Purpose:
*       This routine will decommit and release ALL of the CRT heap.
*       All memory malloc-ed by the CRT will then be invalid.
*
*       NOTES:
*       (1) This routine should only be called once!
*       (2) This routine must be called AFTER any other heap requests.
*
*Entry:
*       <void>
*Exit:
*       <void>
*
*Exceptions:
*
*******************************************************************************/

void __cdecl _heap_term (
        void
        )
{
    int index;
    void **pageptr;

    /*
     * Loop through the region descriptor table, decommitting
     * and releasing (freeing up) each region that is in use.
     */

    for ( index=0 ; index < _HEAP_REGIONMAX ; index++ ) {
        void * regbase ;

        if ( (regbase = _heap_regions[index]._regbase)
          && VirtualFree(regbase, _heap_regions[index]._currsize, MEM_DECOMMIT)
          && VirtualFree(regbase, 0, MEM_RELEASE) )
                regbase = _heap_regions[index]._regbase = NULL ;
    }

    /*
     * Now we need to decommit and release the pages used for descriptors
     * _heap_descpages points to the head of a singly-linked list of the pages.
     */

    pageptr = _heap_descpages;

    while ( pageptr ) {
        void **nextpage;

        nextpage = *pageptr;

        if(!VirtualFree(pageptr, 0, MEM_RELEASE))
            break;      /* if the linked list is corrupted, give up */

        pageptr = nextpage;
    }

}



/***
* _heap_grow_emptylist() - Grow the empty heap descriptor list
*
*Purpose:
*       (1) Get memory from OS
*       (2) Form it into a linked list of empty heap descriptors
*       (3) Attach it to the master empty list
*
*       NOTE:  This routine assumes that the emptylist is NULL
*       when called (i.e., there are no available empty heap descriptors).
*
*Entry:
*       (void)
*
*Exit:
*       1, if the empty heap descriptor list was grown
*       0, if the empty heap descriptor list could not be grown.
*
*Exceptions:
*
*******************************************************************************/

static int __cdecl _heap_grow_emptylist (
        void
        )
{
        REG1 _PBLKDESC first;
        REG2 _PBLKDESC next;
        _PBLKDESC last;

        /*
         * Get memory for the new empty heap descriptors
         *
         * Note that last is used to hold the returned pointer because
         * first (and next) are register class.
         */

        if ( !(last = VirtualAlloc(NULL,
                                   _HEAP_EMPTYLIST_SIZE,
                                   MEM_COMMIT,
                                   PAGE_READWRITE)) )
                return 0;

        /*
         * Add this descriptor block to the front of the list
         *
         * Advance "last" to skip over the
         */

        *(void **)last = _heap_descpages;
        _heap_descpages = (void **)(last++);


        /*
         * Init the empty heap descriptor list.
         */

        _heap_desc.emptylist = first = last;


        /*
         * Carve the memory into an empty list

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美一区二区三区孕妇| 欧美亚洲一区二区在线观看| 日韩三级视频中文字幕| 亚洲妇熟xx妇色黄| 日本韩国一区二区三区视频| 亚洲免费视频中文字幕| 99vv1com这只有精品| 国产精品二三区| 9人人澡人人爽人人精品| 国产精品久久久久aaaa樱花 | 中文字幕第一区二区| 国产精品影视天天线| 久久丝袜美腿综合| 国产精品正在播放| 春色校园综合激情亚洲| 久久久国际精品| 国产成人综合自拍| 欧美激情一区二区| 波多野结衣的一区二区三区| 国产精品女同互慰在线看| 成人美女视频在线观看18| 中文字幕不卡一区| 99久久精品免费看| 亚洲啪啪综合av一区二区三区| 成人av在线电影| 亚洲男人都懂的| 欧美体内she精视频| 亚洲成人第一页| 裸体歌舞表演一区二区| 精品国一区二区三区| 韩国三级在线一区| 国产精品网站在线| 91网站在线播放| 亚洲在线一区二区三区| 欧美日韩国产大片| 久久福利资源站| 欧美激情在线一区二区三区| av亚洲产国偷v产偷v自拍| 亚洲欧美一区二区久久| 欧美日韩不卡一区| 裸体在线国模精品偷拍| 国产亚洲1区2区3区| av一区二区三区在线| 欧美日韩你懂的| 蜜臀久久久久久久| 久久精品欧美一区二区三区不卡| 成人丝袜视频网| 亚洲综合色视频| 日韩美女主播在线视频一区二区三区| 国产一区激情在线| 亚洲欧美激情小说另类| 欧美精品第1页| 国产真实精品久久二三区| 国产精品久久久久久久久久久免费看 | 韩国v欧美v日本v亚洲v| 国产精品美女久久久久久2018| 在线欧美小视频| 久久99精品一区二区三区三区| 亚洲国产精品二十页| 欧美色手机在线观看| 激情小说欧美图片| 亚洲女爱视频在线| 日韩一区二区精品葵司在线| 高潮精品一区videoshd| 亚洲国产精品自拍| 久久香蕉国产线看观看99| 在线观看亚洲精品| 久久精品免费在线观看| 欧美亚洲愉拍一区二区| 国产精品一区二区x88av| 亚洲激情图片一区| 精品va天堂亚洲国产| 色网综合在线观看| 激情五月播播久久久精品| 一区二区在线电影| xnxx国产精品| 欧美视频一二三区| 国产成+人+日韩+欧美+亚洲| 亚洲成人动漫在线观看| 中文字幕欧美三区| 欧美一级艳片视频免费观看| 99国产精品久久| 精品在线免费视频| 欧美性猛交一区二区三区精品| 黄色小说综合网站| 亚洲国产中文字幕| 国产精品蜜臀在线观看| 欧美哺乳videos| 欧美综合在线视频| www.色精品| 国产一区二区三区不卡在线观看 | 91蝌蚪porny成人天涯| 狠狠色丁香婷综合久久| 亚洲一区二区免费视频| 欧美极品美女视频| 国模大尺度一区二区三区| 亚洲国产中文字幕在线视频综合| 国产欧美精品一区aⅴ影院 | 欧美va在线播放| 欧美日韩亚洲另类| 91亚洲国产成人精品一区二区三 | 成人午夜在线视频| 精品一区二区三区在线观看国产| 亚洲mv大片欧洲mv大片精品| 国产精品国产三级国产普通话三级 | 国产精品青草久久| 精品欧美乱码久久久久久1区2区 | 91一区二区在线观看| 国产精品 欧美精品| 久久国产精品无码网站| 亚洲国产日韩精品| 亚洲欧美日韩国产一区二区三区 | 欧美激情一区二区三区四区| 精品国产免费视频| 欧美高清性hdvideosex| 在线免费观看日本一区| 99视频有精品| 成人免费电影视频| 欧美国产日本视频| 久久久久国产成人精品亚洲午夜| 欧美成人aa大片| 日韩一区二区在线观看视频| 欧美日韩国产三级| 欧美精品自拍偷拍动漫精品| 欧美午夜片在线观看| 欧美亚洲国产怡红院影院| 色婷婷av一区二区| 91在线观看高清| 91在线你懂得| 97久久久精品综合88久久| 成人av手机在线观看| 成人性生交大片免费| 成人av资源在线观看| 成人h版在线观看| aaa亚洲精品| 99国产精品久久久久| 一区二区三区在线视频免费观看| 综合色天天鬼久久鬼色| 最新国产の精品合集bt伙计| 国产精品美日韩| 亚洲日本一区二区三区| 亚洲欧美激情在线| 亚洲一区二区三区爽爽爽爽爽 | 午夜视频一区二区三区| 亚洲超碰97人人做人人爱| 午夜精品福利一区二区蜜股av| 天堂va蜜桃一区二区三区漫画版| 丝瓜av网站精品一区二区| 天天色天天操综合| 蜜桃一区二区三区在线观看| 久久成人久久爱| 国产一区不卡在线| 中文字幕av资源一区| 一区在线播放视频| 亚洲激情图片qvod| 无码av免费一区二区三区试看| 天堂在线一区二区| 精品一区二区三区日韩| 国产精选一区二区三区| eeuss鲁一区二区三区| 色综合久久久久网| 欧美午夜一区二区三区免费大片| 欧美日韩激情一区二区| 日韩欧美一区中文| 国产午夜亚洲精品不卡| 国产精品国产自产拍高清av| 亚洲一线二线三线视频| 婷婷成人综合网| 激情综合网av| av在线播放成人| 丝袜国产日韩另类美女| 久久99国产乱子伦精品免费| 成人性生交大片免费看视频在线 | 亚洲天堂a在线| 亚洲成人av一区二区| 精品一区二区三区在线视频| 成人av网站在线| 欧美精品xxxxbbbb| 久久婷婷国产综合精品青草| 综合中文字幕亚洲| 丝袜国产日韩另类美女| 高清不卡在线观看av| 在线观看精品一区| 精品久久久久久久久久久久久久久久久 | 一本一道久久a久久精品综合蜜臀| 欧美午夜不卡视频| 26uuu国产日韩综合| 亚洲精品欧美激情| 精品一区免费av| 色综合一区二区三区| 日韩一区二区三区在线| 中文字幕巨乱亚洲| 日韩精品亚洲专区| 春色校园综合激情亚洲| 6080日韩午夜伦伦午夜伦| 中文子幕无线码一区tr| 五月天婷婷综合| 国产91对白在线观看九色| 欧美日韩精品一区二区三区| 成人精品国产福利|