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

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

?? malloc.c

?? C標準庫源代碼,能提高對C的理解,不錯的哦
?? C
字號:
/***
*malloc.c - Get a block of memory from the heap
*
*       Copyright (c) 1989-1997, Microsoft Corporation. All rights reserved.
*
*Purpose:
*       Defines the malloc() function.
*
*******************************************************************************/

#include <cruntime.h>
#include <malloc.h>
#include <internal.h>
#include <mtdll.h>
#include <dbgint.h>

#ifdef WINHEAP
#include <windows.h>
#include <winheap.h>
#else  /* WINHEAP */
#include <heap.h>
#endif  /* WINHEAP */


extern int _newmode;    /* malloc new() handler mode */


/***
*void *malloc(size_t size) - Get a block of memory from the heap
*
*Purpose:
*       Allocate of block of memory of at least size bytes from the heap and
*       return a pointer to it.
*
*       Calls the new appropriate new handler (if installed).
*
*Entry:
*       size_t size - size of block requested
*
*Exit:
*       Success:  Pointer to memory block
*       Failure:  NULL (or some error value)
*
*Uses:
*
*Exceptions:
*
*******************************************************************************/

void * __cdecl _malloc_base (size_t size)

{
        return _nh_malloc_base(size, _newmode);
}


/***
*void *_nh_malloc_base(size_t size) - Get a block of memory from the heap
*
*Purpose:
*       Allocate of block of memory of at least size bytes from the heap and
*       return a pointer to it.
*
*       Calls the appropriate new handler (if installed).
*
*       There are two distinct new handler schemes supported. The 'new' ANSI
*       C++ scheme overrides the 'old' scheme when it is activated. A value of
*       _NOPTH for the 'new' handler indicates that it is inactivated and the
*       'old' handler is then called.
*
*Entry:
*       size_t size - size of block requested
*
*Exit:
*       Success:  Pointer to memory block
*       Failure:  NULL (or some error value)
*
*Uses:
*
*Exceptions:
*
*******************************************************************************/

void * __cdecl _nh_malloc_base (size_t size, int nhFlag)
{
        void * pvReturn;

        //  validate size
        if (size > _HEAP_MAXREQ)
            return NULL;

#ifndef WINHEAP
        /* round requested size */
        size = _ROUND2(size, _GRANULARITY);
#endif  /* WINHEAP */

        for (;;) {

            //  allocate memory block
            if (size <= _HEAP_MAXREQ)
                pvReturn = _heap_alloc_base(size);
            else
                pvReturn = NULL;

            //  if successful allocation, return pointer to memory
            //  if new handling turned off altogether, return NULL

            if (pvReturn || nhFlag == 0)
                return pvReturn;

            //  call installed new handler
            if (!_callnewh(size))
                return NULL;

            //  new handler was successful -- try to allocate again
        }
}

/***
*void *_heap_alloc_base(size_t size) - does actual allocation
*
*Purpose:
*       Same as malloc() except the new handler is not called.
*
*Entry:
*       See malloc
*
*Exit:
*       See malloc
*
*Exceptions:
*
*******************************************************************************/

void * __cdecl _heap_alloc_base (size_t size)

{
#ifdef WINHEAP
        void * pvReturn;
#else  /* WINHEAP */
        _PBLKDESC pdesc;
        _PBLKDESC pdesc2;
#endif  /* WINHEAP */


#ifdef WINHEAP

        if (size <= __sbh_threshold)
        {
            _mlock(_HEAP_LOCK);
            pvReturn = __sbh_alloc_block(size);
            _munlock(_HEAP_LOCK);
            if (pvReturn)
                return pvReturn;
        }

        if (size == 0)
            size = 1;
        size = (size + BYTES_PER_PARA - 1) & ~(BYTES_PER_PARA - 1);
        return HeapAlloc(_crtheap, 0, size);
}

#else  /* WINHEAP */

        /* try to find a big enough free block
         */
        if ( (pdesc = _heap_search(size)) == NULL )
        {
            if ( _heap_grow(size) != -1 )
            {
                /* try finding a big enough free block again. the
                 * success of the call to _heap_grow should guarantee
                 * it, but...
                 */
                if ( (pdesc = _heap_search(size)) == NULL )
                {
                    /* something unexpected, and very bad, has
                     * happened. abort!
                     */
                    _heap_abort();
                }
            }
            else
                return NULL;
        }

        /* carve the block into two pieces (if necessary). the first piece
         * shall be of the exact requested size, marked inuse and returned to
         * the caller. the leftover piece is to be marked free.
         */
        if ( _BLKSIZE(pdesc) != size ) {
            /* split up the block and free the leftover piece back to
             * the heap
             */
            if ( (pdesc2 = _heap_split_block(pdesc, size)) != NULL )
                _SET_FREE(pdesc2);
        }

        /* mark pdesc inuse
         */
        _SET_INUSE(pdesc);

        /* check proverdesc and reset, if necessary
         */

        _heap_desc.proverdesc = pdesc->pnextdesc;

        return( (void *)((char *)_ADDRESS(pdesc) + _HDRSIZE) );
}


/***
*_PBLKDESC _heap_split_block(pdesc, newsize) - split a heap allocation block
*       into two allocation blocks
*
*Purpose:
*       Split the allocation block described by pdesc into two blocks, the
*       first one being of newsize bytes.
*
*       Notes: It is caller's responsibilty to set the status (i.e., free
*       or inuse) of the two new blocks, and to check and reset proverdesc
*       if necessary. See Exceptions (below) for additional requirements.
*
*Entry:
*       _PBLKDESC pdesc - pointer to the allocation block descriptor
*       size_t newsize  - size for the first of the two sub-blocks (i.e.,
*                 (i.e., newsize == _BLKSIZE(pdesc), on exit)
*
*Exit:
*       If successful, return a pointer to the descriptor for the leftover
*       block.
*       Otherwise, return NULL.
*
*Exceptions:
*       It is assumed pdesc points to a valid allocation block descriptor and
*       newsize is a valid heap block size as is (i.e., WITHOUT rounding). If
*       either of these of assumption is violated, _heap_split_block() will
*       likely corrupt the heap. Note also that _heap_split_block will simply
*       return to the caller if newsize >= _BLKSIZE(pdesc), on entry.
*
*******************************************************************************/

_PBLKDESC __cdecl _heap_split_block (
        REG1 _PBLKDESC pdesc,
        size_t newsize
        )
{
        REG2 _PBLKDESC pdesc2;

        _ASSERTE(("_heap_split_block: bad pdesc arg", _CHECK_PDESC(pdesc)));
        _ASSERTE(("_heap_split_block: bad newsize arg", _ROUND2(newsize,_GRANULARITY) == newsize));

        /* carve the block into two pieces (if possible). the first piece
         * is to be exactly newsize bytes.
         */
        if ( (_BLKSIZE(pdesc) > newsize) && ((pdesc2 = __getempty())
               != NULL) )
        {
            /* set it up to manage the second piece and link it in to
             * the list
             */
            pdesc2->pblock = (void *)((char *)_ADDRESS(pdesc) + newsize +
                     _HDRSIZE);
            *(void **)(pdesc2->pblock) = pdesc2;
            pdesc2->pnextdesc = pdesc->pnextdesc;
            pdesc->pnextdesc = pdesc2;

            return pdesc2;
        }
        return NULL;
}

#endif  /* WINHEAP */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精品久久99久久在免费线 | 日本一区二区三区国色天香| 精品三级在线看| 欧美激情综合在线| 亚洲一区在线免费观看| 久久国产精品99久久人人澡| 成人国产亚洲欧美成人综合网| 在线亚洲人成电影网站色www| 4438x成人网最大色成网站| 欧美三级电影网| 国产亚洲美州欧州综合国| 亚洲黄色av一区| 国模大尺度一区二区三区| 91丨porny丨最新| 精品卡一卡二卡三卡四在线| 亚洲综合免费观看高清完整版在线| 日韩经典一区二区| 日韩精品中文字幕在线不卡尤物 | 日韩欧美一区二区视频| 国产精品高潮久久久久无| 亚洲成人动漫在线观看| 99re热这里只有精品免费视频| 91婷婷韩国欧美一区二区| 国产精品久久看| 久久精品国产亚洲一区二区三区| 99热在这里有精品免费| 精品国产凹凸成av人网站| 国产丝袜欧美中文另类| 日本大胆欧美人术艺术动态| 在线影视一区二区三区| 国产精品短视频| 粉嫩高潮美女一区二区三区| 日韩欧美成人激情| 亚洲亚洲精品在线观看| 成人国产亚洲欧美成人综合网| 精品蜜桃在线看| 日韩av电影一区| 欧美精品黑人性xxxx| 国产精品三级在线观看| 激情伊人五月天久久综合| 欧美日韩成人一区二区| 亚洲国产欧美日韩另类综合 | 欧美极品少妇xxxxⅹ高跟鞋 | 精品在线一区二区| 欧美在线播放高清精品| 亚洲在线成人精品| av在线不卡网| 国产精品国产三级国产专播品爱网| 精久久久久久久久久久| 久久综合久久综合亚洲| 一区二区理论电影在线观看| 色一区在线观看| 亚洲精品中文字幕在线观看| 91在线无精精品入口| 亚洲精品视频免费观看| 91久久精品一区二区三区| 亚洲精品美腿丝袜| 欧美性大战xxxxx久久久| 亚洲成在线观看| 欧美精品三级在线观看| 日本欧美在线观看| 日韩精品一区二区在线观看| 久久成人免费电影| 久久精品亚洲麻豆av一区二区| 国产精品一区一区三区| 中文字幕在线播放不卡一区| 懂色中文一区二区在线播放| 国产精品视频一区二区三区不卡| 成人黄页在线观看| 国产精品女主播av| 欧美综合一区二区| 日产精品久久久久久久性色| 久久亚洲二区三区| 成人激情黄色小说| 亚洲成国产人片在线观看| 91精品麻豆日日躁夜夜躁| 精品午夜一区二区三区在线观看| 亚洲国产精品黑人久久久| 91麻豆国产香蕉久久精品| 亚洲动漫第一页| 国产精品久久久久影院老司| 欧美一区二区在线免费观看| 色欧美日韩亚洲| 成人高清免费观看| 老司机午夜精品| 丝袜美腿亚洲综合| 亚洲精品视频免费看| 亚洲国产精品ⅴa在线观看| 日韩一区二区免费电影| 欧美三日本三级三级在线播放| 成人午夜激情视频| 久久99久国产精品黄毛片色诱| 午夜欧美电影在线观看| 亚洲天堂a在线| 欧美激情一区不卡| 久久亚洲精精品中文字幕早川悠里| 欧美电影在线免费观看| 欧美日韩免费电影| 色乱码一区二区三区88| jlzzjlzz国产精品久久| 成人永久aaa| 国产成人在线免费观看| 国产一区二区三区免费| 国产一区二区在线看| 精品午夜一区二区三区在线观看 | 日韩欧美中文字幕公布| 欧美日韩一级视频| 欧美亚洲图片小说| 欧美性猛交xxxx黑人交| 色欧美日韩亚洲| 欧美视频完全免费看| 欧美亚洲综合网| 欧美日本高清视频在线观看| 欧美精品vⅰdeose4hd| 7777精品伊人久久久大香线蕉完整版 | ㊣最新国产の精品bt伙计久久| 欧美激情一区二区| 国产精品国产三级国产专播品爱网 | 欧美va亚洲va国产综合| 欧美精品一区二区久久婷婷| www久久精品| 欧美国产亚洲另类动漫| 中文字幕亚洲在| 一区二区欧美精品| 日本va欧美va瓶| 国内精品伊人久久久久av影院| 精品一区二区久久| 成人h版在线观看| 色天使色偷偷av一区二区| 欧美日韩另类国产亚洲欧美一级| 欧美一区二区人人喊爽| 久久综合五月天婷婷伊人| 国产精品毛片久久久久久久| 亚洲精品国产一区二区三区四区在线 | 中文字幕日韩一区| 一区二区三区中文字幕精品精品| 亚洲电影中文字幕在线观看| 久久国产人妖系列| 波多野结衣91| 884aa四虎影成人精品一区| 国产视频亚洲色图| 亚洲自拍偷拍网站| 国内精品免费在线观看| 99精品国产91久久久久久 | 青娱乐精品视频在线| 国产精品亚洲专一区二区三区| 91亚洲国产成人精品一区二三 | 亚洲成人久久影院| 国内精品嫩模私拍在线| 在线观看欧美黄色| 久久婷婷综合激情| 亚洲永久免费视频| 国产精品伊人色| 欧美日韩国产首页| 中文字幕乱码亚洲精品一区| 亚洲午夜激情av| 国产91丝袜在线播放九色| 欧美精品在线视频| 亚洲欧洲制服丝袜| 国产精品一区二区久激情瑜伽| 欧美在线视频你懂得| 欧美国产成人精品| 奇米影视在线99精品| 一本大道av一区二区在线播放 | 亚洲男人的天堂在线观看| 久久精品国产精品青草| 欧美中文字幕一区二区三区亚洲| 26uuu欧美日本| 日本午夜精品视频在线观看| 99久久国产综合精品色伊| 亚洲精品一区二区三区99| 日韩主播视频在线| 在线亚洲精品福利网址导航| 国产精品理伦片| 国产在线日韩欧美| 51精品国自产在线| 五月天久久比比资源色| 色天天综合色天天久久| 国产精品区一区二区三| 极品尤物av久久免费看| 666欧美在线视频| 亚洲成av人片一区二区梦乃| 在线一区二区三区四区五区| 日韩理论片网站| 不卡的av电影| 中文一区二区完整视频在线观看| 国精产品一区一区三区mba视频| 欧美日韩一级片在线观看| 亚洲高清中文字幕| 欧美在线播放高清精品| 亚洲综合丝袜美腿| 欧美在线视频日韩| 亚洲成a人片在线不卡一二三区| 日本大香伊一区二区三区| 亚洲美女区一区| 在线中文字幕不卡| 偷拍一区二区三区四区| 欧美久久久久中文字幕| 日韩国产一二三区| 日韩视频永久免费|