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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? heapgrow.c

?? C標(biāo)準(zhǔn)庫源代碼,能提高對C的理解,不錯的哦
?? C
?? 第 1 頁 / 共 2 頁
字號:
/***
*heapgrow.c - Grow the heap
*
*       Copyright (c) 1989-1997, Microsoft Corporation. All rights reserved.
*
*Purpose:
*       Get memory from OS and add to the heap.
*
*******************************************************************************/

#ifndef WINHEAP

#ifdef _WIN32


#include <cruntime.h>
#include <oscalls.h>
#include <heap.h>
#include <malloc.h>
#include <stdlib.h>

static int __cdecl _heap_new_region(unsigned, size_t);


/***
*_heap_grow() - Grow the heap
*
*Purpose:
*       Get memory from the OS and add it to the heap.
*
*Entry:
*       size_t _size = user's block request
*
*Exit:
*        0 = success, new mem is in the heap
*       -1 = failure
*
*Exceptions:
*
*******************************************************************************/

int __cdecl _heap_grow (
        REG1 size_t size
        )
{
        REG2 int index;
        int free_entry = -1;

        /*
         * Bump size to include header and round to nearest page boundary.
         */

        size += _HDRSIZE;
        size = _ROUND2(size,_PAGESIZE_);

        /*
         * Loop through the region table looking for an existing region
         * we can grow.  Remember the index of the first null region entry.
         *
         * size = size of grow request
         */

        for (index = 0; index < _HEAP_REGIONMAX; index++) {

                if ( (_heap_regions[index]._totalsize -
                    _heap_regions[index]._currsize) >= size )

                        /*
                         * Grow this region to satisfy the request.
                         */

                        return( _heap_grow_region(index, size) );


                if ( (free_entry == -1) &&
                    (_heap_regions[index]._regbase == NULL) )

                        /*
                         * Remember 1st free table entry for later
                         */

                        free_entry = index;

        }

        /*
         * Could not find any existing regions to grow.  Try to
         * get a new region.
         *
         * size = size of grow request
         * free_entry = index of first free entry in table
         */

        if ( free_entry >= 0 )

                /*
                 * Get a new region to satisfy the request.
                 */

                return( _heap_new_region(free_entry, size) );

        else
                /*
                 * No free table entries: return an error.
                 */

                return(-1);

}


/***
*_heap_new_region() - Get a new heap region
*
*Purpose:
*       Get a new heap region and put it in the region table.
*       Also, grow it large enough to support the caller's
*       request.
*
*       NOTES:
*       (1) Caller has verified that there is room in the _heap_region
*       table for another region.
*       (2) The caller must have rounded the size to a page boundary.
*
*Entry:
*       int index = index in table where new region data should go
*       size_t size = size of request (this has been rounded to a
*                       page-sized boundary)
*
*Exit:
*        0 = success
*       -1 = failure
*
*Exceptions:
*
*******************************************************************************/

static int __cdecl _heap_new_region (
        REG1 unsigned index,
        size_t size
        )
{
        void * region;
        REG2 unsigned int regsize;


        /*
         * Round the heap region size to a page boundary (in case
         * the user played with it).
         */

        regsize = _ROUND2(_heap_regionsize, _PAGESIZE_);

        /*
         * To acommodate large users, request twice
         * as big a region next time around.
         */

        if ( _heap_regionsize < _heap_maxregsize )
                _heap_regionsize *= 2 ;

        /*
         * See if region is big enough for request
         */

        if (regsize < size)
                regsize = size;

        /*
         * Go get the new region
         */

        if (!(region = VirtualAlloc(NULL, regsize, MEM_RESERVE,
        PAGE_READWRITE)))
                goto error;

        /*
         * Put the new region in the table.
         */

         _heap_regions[index]._regbase = region;
         _heap_regions[index]._totalsize = regsize;
         _heap_regions[index]._currsize = 0;


        /*
         * Grow the region to satisfy the size request.
         */

        if (_heap_grow_region(index, size) != 0) {

                /*
                 * Ouch.  Allocated a region but couldn't commit
                 * any pages in it.  Free region and return error.
                 */

                _heap_free_region(index);
                goto error;
        }


        /*
         * Good return
         */

        /* done:   unreferenced label to be removed */
                return(0);

        /*
         * Error return
         */

        error:
                return(-1);

}


/***
*_heap_grow_region() - Grow a heap region
*
*Purpose:
*       Grow a region and add the new memory to the heap.
*
*       NOTES:
*       (1) The caller must have rounded the size to a page boundary.
*
*Entry:
*       unsigned index = index of region in the _heap_regions[] table
*       size_t size = size of request (this has been rounded to a
*                       page-sized boundary)
*
*Exit:
*        0 = success
*       -1 = failure
*
*Exceptions:
*
*******************************************************************************/

int __cdecl _heap_grow_region (
        REG1 unsigned index,
        size_t size
        )
{
        size_t left;
        REG2 size_t growsize;
        void * base;
        unsigned dosretval;


        /*
         * Init some variables
         * left = space left in region
         * base = base of next section of region to validate
         */

        left = _heap_regions[index]._totalsize -
                _heap_regions[index]._currsize;

        base = (char *) _heap_regions[index]._regbase +
                _heap_regions[index]._currsize;

        /*
         * Make sure we can satisfy request
         */

        if (left < size)
                goto error;

        /*
         * Round size up to next _heap_growsize boundary.
         * (Must round _heap_growsize itself to page boundary, in
         * case user set it himself).
         */

        growsize = _ROUND2(_heap_growsize, _PAGESIZE_);
        growsize = _ROUND(size, growsize);

        if (left < growsize)
                growsize = left;

        /*
         * Validate the new portion of the region
         */

        if (!VirtualAlloc(base, growsize, MEM_COMMIT, PAGE_READWRITE))
                dosretval = GetLastError();
        else
                dosretval = 0;

        if (dosretval)
                /*
                 * Error committing pages.  If out of memory, return
                 * error, else abort.
                 */

                if (dosretval == ERROR_NOT_ENOUGH_MEMORY)
                        goto error;
                else
                        _heap_abort();


        /*
         * Update the region data base
         */

        _heap_regions[index]._currsize += growsize;




        /*
         * Add the memory to the heap
         */

        if (_heap_addblock(base, growsize) != 0)
                _heap_abort();


        /*
         * Good return
         */

        /* done:   unreferenced label to be removed */
                return(0);

        /*
         * Error return
         */

        error:
                return(-1);

}


/***
*_heap_free_region() - Free up a region
*
*Purpose:
*       Return a heap region to the OS and zero out
*       corresponding region data entry.
*
*Entry:
*       int index = index of region to be freed
*
*Exit:
*       void
*
*Exceptions:
*
*******************************************************************************/

void __cdecl _heap_free_region (
        REG1 int index
        )
{

        /*
         * Give the memory back to the OS
         */

        if (!VirtualFree(_heap_regions[index]._regbase, 0, MEM_RELEASE))
                _heap_abort();

        /*
         * Zero out the heap region entry
         */

        _heap_regions[index]._regbase = NULL;
        _heap_regions[index]._currsize =
        _heap_regions[index]._totalsize = 0;

}


#else  /* _WIN32 */

#if defined (_M_MPPC) || defined (_M_M68K)


#include <cruntime.h>
#include <heap.h>
#include <malloc.h>
#include <stdlib.h>
#include <string.h>
#include <macos\memory.h>               // Mac OS interface header
#include <macos\errors.h>
#include <macos\types.h>
#include <macos\traps.h>

static int __cdecl _heap_new_region(unsigned, size_t);
extern Handle hHeapRegions;
extern int _heap_region_table_cur;

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产毛片精品一区| 日韩国产欧美在线播放| 成人网男人的天堂| 亚洲国产成人一区二区三区| 成人精品视频网站| 亚洲欧洲日韩综合一区二区| 91小视频在线免费看| 亚洲五码中文字幕| 欧美大度的电影原声| 九色综合狠狠综合久久| www国产精品av| 成人黄页毛片网站| 一区二区理论电影在线观看| 欧美另类z0zxhd电影| 久久精品国产一区二区三| 欧美韩国日本一区| 欧美亚男人的天堂| 麻豆91在线播放免费| 国产喷白浆一区二区三区| 91在线视频播放| 日韩高清欧美激情| 亚洲欧美日韩成人高清在线一区| 日本道在线观看一区二区| 亚洲bdsm女犯bdsm网站| 久久综合丝袜日本网| 99re免费视频精品全部| 丝袜美腿亚洲一区二区图片| 欧美精品一区二区不卡| 91麻豆精品一区二区三区| 日韩国产高清在线| 中文字幕一区二区三区av| 欧美日韩国产三级| 成人免费视频app| 午夜精品福利一区二区蜜股av| 久久综合色8888| 欧美性xxxxxxxx| 成人丝袜18视频在线观看| 午夜a成v人精品| 国产精品久久国产精麻豆99网站| 在线成人免费观看| 成人黄色综合网站| 精品一区二区在线免费观看| 亚洲一二三四久久| 中文文精品字幕一区二区| 91精品国产高清一区二区三区 | 亚洲午夜激情av| 精品动漫一区二区三区在线观看| 91久久精品一区二区三区| 国产一区二区精品久久| 亚洲一区二区在线免费观看视频| 国产精品丝袜在线| 精品国产区一区| 337p亚洲精品色噜噜狠狠| 91欧美一区二区| 国产精品一区二区你懂的| 免费观看久久久4p| 亚洲香肠在线观看| 亚洲图片你懂的| 久久久久青草大香线综合精品| 欧美一卡二卡三卡四卡| 欧美午夜精品理论片a级按摩| 成人免费高清视频在线观看| 九九国产精品视频| 首页综合国产亚洲丝袜| 艳妇臀荡乳欲伦亚洲一区| 中文字幕av资源一区| 精品国产伦一区二区三区观看体验 | 久久综合久久综合亚洲| 777奇米四色成人影色区| 91黄视频在线观看| 日本久久精品电影| 色综合天天综合| 97久久超碰精品国产| 成人午夜电影小说| 成人ar影院免费观看视频| 国产成人av影院| 成人在线综合网| 高清av一区二区| 成人永久aaa| 成人va在线观看| 99天天综合性| 色狠狠桃花综合| 色视频一区二区| 欧美亚洲综合色| 欧美日本一区二区三区| 8v天堂国产在线一区二区| 欧美精品一卡两卡| 91精品国产色综合久久不卡蜜臀| 欧美精品粉嫩高潮一区二区| 日韩一区二区在线观看| 日韩欧美在线1卡| 精品久久久久av影院| 久久久久国产精品厨房| 亚洲国产成人一区二区三区| 中文字幕一区二区三区在线播放 | 成人18视频在线播放| 成人aa视频在线观看| 在线观看av一区| 欧美日韩免费一区二区三区视频| 91精品国产综合久久精品性色| 精品免费国产一区二区三区四区| 亚洲精品一区二区三区香蕉| 欧美极品aⅴ影院| 亚洲六月丁香色婷婷综合久久 | 国产一区在线精品| 成人高清视频在线| 欧美色精品在线视频| 日韩欧美中文字幕精品| 国产欧美在线观看一区| 亚洲欧美欧美一区二区三区| 日本成人在线看| 国产风韵犹存在线视精品| 在线亚洲欧美专区二区| 91精品欧美一区二区三区综合在| 久久欧美中文字幕| 亚洲美女视频在线| 捆绑紧缚一区二区三区视频| 国产不卡视频一区二区三区| 欧美日韩久久不卡| 久久精品人人爽人人爽| 亚洲一区二区免费视频| 国产精品白丝jk黑袜喷水| 色综合中文字幕| 久久亚洲精精品中文字幕早川悠里| 亚洲手机成人高清视频| 免费看日韩精品| 色综合中文字幕国产| 欧美电影一区二区| 国产精品毛片高清在线完整版| 亚洲成va人在线观看| 国产成人啪午夜精品网站男同| 欧美色爱综合网| 国产精品久久久久一区| 麻豆一区二区在线| 色婷婷精品久久二区二区蜜臂av| 欧美成人精精品一区二区频| 亚洲女人的天堂| 国产一区二区网址| 777精品伊人久久久久大香线蕉| 亚洲欧美综合在线精品| 激情欧美日韩一区二区| 欧美日韩国产在线观看| 中文字幕一区av| 精品一二线国产| 久久只精品国产| 五月天久久比比资源色| 色网综合在线观看| 国产精品久久久久久久午夜片| 裸体歌舞表演一区二区| 7777精品伊人久久久大香线蕉经典版下载| 日本一区二区动态图| 激情综合五月天| 欧美一级日韩免费不卡| 亚洲无人区一区| 色婷婷久久99综合精品jk白丝| 国产精品你懂的在线| 国产美女主播视频一区| 精品国产在天天线2019| 日韩福利视频网| 欧美日本一区二区| 亚洲成人免费视| 欧美日精品一区视频| 一区二区三区国产豹纹内裤在线| av电影在线观看一区| 国产精品久久久久久久久免费丝袜| 国产精品亚洲成人| 久久久美女艺术照精彩视频福利播放| 免费看日韩精品| 日韩精品最新网址| 国产一区91精品张津瑜| 久久久青草青青国产亚洲免观| 国产激情精品久久久第一区二区 | 久久五月婷婷丁香社区| 国产自产v一区二区三区c| 欧美精品一区二区蜜臀亚洲| 国产一区二区成人久久免费影院| 欧美zozozo| 国产高清成人在线| 亚洲欧美一区二区在线观看| 成人的网站免费观看| 亚洲精品老司机| 欧美三级视频在线| 青青草91视频| 久久久精品免费网站| 丰满放荡岳乱妇91ww| 日韩理论片在线| 欧美午夜宅男影院| 免费观看在线综合| 国产日韩欧美一区二区三区乱码 | 国产传媒一区在线| 中文字幕日韩av资源站| 在线一区二区视频| 日本欧美在线观看| 久久精品网站免费观看| 99re8在线精品视频免费播放| 亚洲主播在线播放| 欧美成va人片在线观看| 成人精品鲁一区一区二区| 亚洲色图视频免费播放| 欧美久久久久久蜜桃|