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

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

?? malloc.c

?? GNU Sed GNU Sed GNU Sed
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* dynamic memory allocation for GNU.
   Copyright (C) 1985, 1987 Free Software Foundation, Inc.

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 1, or (at your option)
    any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

In other words, you are welcome to use, share and improve this program.
You are forbidden to forbid anyone else to use, share and improve
what you give them.   Help stamp out software-hoarding!  */

/* TimF@microsoft.com:	19-MAR-92  Port to Microsoft's Windows NT (tm) */


/*
 * @(#)nmalloc.c 1 (Caltech) 2/21/82
 *
 *	U of M Modified: 20 Jun 1983 ACT: strange hacks for Emacs
 *
 *	Nov 1983, Mike@BRL, Added support for 4.1C/4.2 BSD.
 *
 * This is a very fast storage allocator.  It allocates blocks of a small 
 * number of different sizes, and keeps free lists of each size.  Blocks
 * that don't exactly fit are passed up to the next larger size.  In this 
 * implementation, the available sizes are (2^n)-4 (or -16) bytes long.
 * This is designed for use in a program that uses vast quantities of
 * memory, but bombs when it runs out.  To make it a little better, it
 * warns the user when he starts to get near the end.
 *
 * June 84, ACT: modified rcheck code to check the range given to malloc,
 * rather than the range determined by the 2-power used.
 *
 * Jan 85, RMS: calls malloc_warning to issue warning on nearly full.
 * No longer Emacs-specific; can serve as all-purpose malloc for GNU.
 * You should call malloc_init to reinitialize after loading dumped Emacs.
 * Call malloc_stats to get info on memory stats if MSTATS turned on.
 * realloc knows how to return same block given, just changing its size,
 * if the power of 2 is correct.
 */

/*
 * nextf[i] is the pointer to the next free block of size 2^(i+3).  The
 * smallest allocatable block is 8 bytes.  The overhead information will
 * go in the first int of the block, and the returned pointer will point
 * to the second.
 *
#ifdef MSTATS
 * nmalloc[i] is the difference between the number of mallocs and frees
 * for a given block size.
#endif MSTATS
 */

#ifdef emacs
/* config.h specifies which kind of system this is.  */
#include "config.h"
#include <signal.h>
#else

/* Determine which kind of system this is.  */
#include <signal.h>
#ifndef SIGTSTP
#ifndef VMS
#ifndef USG
#define USG
#endif
#endif /* not VMS */
#else /* SIGTSTP */
#ifdef SIGIO
#define BSD4_2
#endif /* SIGIO */
#endif /* SIGTSTP */

#endif /* not emacs */

/* Define getpagsz () if the system does not.  */
#include "getpagsz.h"

#ifdef BSD
#ifdef BSD4_1
#include <sys/vlimit.h>		/* warn the user when near the end */
#else /* if 4.2 or newer */
#include <sys/time.h>
#include <sys/resource.h>
#endif /* if 4.2 or newer */
#endif

#ifdef VMS
#include "vlimit.h"
#endif

#ifdef	WINDOWSNT
#include	<windows.h>
#endif

extern char *start_of_data ();

#define ISALLOC ((char) 0xf7)	/* magic byte that implies allocation */
#define ISFREE ((char) 0x54)	/* magic byte that implies free block */
				/* this is for error checking only */
#define ISMEMALIGN ((char) 0xd6)  /* Stored before the value returned by
				     memalign, with the rest of the word
				     being the distance to the true
				     beginning of the block.  */


/* These two are for user programs to look at, when they are interested.  */

unsigned int malloc_sbrk_used;       /* amount of data space used now */
unsigned int malloc_sbrk_unused;     /* amount more we can have */

/* start of data space; can be changed by calling init_malloc */
static char *data_space_start;

#ifdef MSTATS
static int nmalloc[30];
static int nmal, nfre;
#endif /* MSTATS */

/* If range checking is not turned on, all we have is a flag indicating
   whether memory is allocated, an index in nextf[], and a size field; to
   realloc() memory we copy either size bytes or 1<<(index+3) bytes depending
   on whether the former can hold the exact size (given the value of
   'index').  If range checking is on, we always need to know how much space
   is allocated, so the 'size' field is never used. */

struct mhead {
	char     mh_alloc;	/* ISALLOC or ISFREE */
	char     mh_index;	/* index in nextf[] */
/* Remainder are valid only when block is allocated */
	unsigned short mh_size;	/* size, if < 0x10000 */
#ifdef rcheck
	unsigned mh_nbytes;	/* number of bytes allocated */
	int      mh_magic4;	/* should be == MAGIC4 */
#endif /* rcheck */
};

/* Access free-list pointer of a block.
  It is stored at block + 4.
  This is not a field in the mhead structure
  because we want sizeof (struct mhead)
  to describe the overhead for when the block is in use,
  and we do not want the free-list pointer to count in that.  */

#define CHAIN(a) \
  (*(struct mhead **) (sizeof (char *) + (char *) (a)))

#ifdef rcheck

/* To implement range checking, we write magic values in at the beginning and
   end of each allocated block, and make sure they are undisturbed whenever a
   free or a realloc occurs. */
/* Written in each of the 4 bytes following the block's real space */
#define MAGIC1 0x55
/* Written in the 4 bytes before the block's real space */
#define MAGIC4 0x55555555
#define ASSERT(p) if (!(p)) botch("p"); else
#define EXTRA  4		/* 4 bytes extra for MAGIC1s */
#else
#define ASSERT(p) if (!(p)) abort (); else
#define EXTRA  0
#endif /* rcheck */

/*
 * I hate magic numbers, besides it's more efficient to make an allocation
 * just under 64k on Windows NT(tm) than it is to make a lot of little ones of
 * about 1k each.  (Since we don't have the equivalent of sbrk...)
 * TimF@Microsoft.Com	15-Feb-92
 */
#ifdef	WINDOWSNT
/* near 64k allocation is much more efficient that 1k on WINDOWSNT */
#define	ALLOCATION_SIZE	(64 * 1024 - 64)
#else /* !WINDOWSNT */
#define	ALLOCATION_SIZE	1024
#endif /* !WINDOWSNT */

/* nextf[i] is free list of blocks of size 2**(i + 3)  */

static struct mhead *nextf[30];

/* busy[i] is nonzero while allocation of block size i is in progress.  */

static char busy[30];

/* Number of bytes of writable memory we can expect to be able to get */
static unsigned int lim_data;

/* Level number of warnings already issued.
  0 -- no warnings issued.
  1 -- 75% warning already issued.
  2 -- 85% warning already issued.
*/
static int warnlevel;

/* Function to call to issue a warning;
   0 means don't issue them.  */
static void (*warnfunction) ();

/* nonzero once initial bunch of free blocks made */
static int gotpool;

char *_malloc_base;

static void getpool ();

char *malloc ();

/* Cause reinitialization based on job parameters;
  also declare where the end of pure storage is. */
void
malloc_init (start, warnfun)
     char *start;
     void (*warnfun) ();
{
  if (start)
    data_space_start = start;
  lim_data = 0;
  warnlevel = 0;
  warnfunction = warnfun;
}

/* Return the maximum size to which MEM can be realloc'd
   without actually requiring copying.  */

int
malloc_usable_size (mem)
     char *mem;
{
  struct mhead *p
    = (struct mhead *) (mem - ((sizeof (struct mhead) + 7) & ~7));
  int blocksize = 8 << p->mh_index;

  return blocksize - sizeof (struct mhead) - EXTRA;
}

static void
morecore (nu)			/* ask system for more memory */
     register int nu;		/* size index to get more of  */
{
  char *sbrk ();
  register char *cp;
  register int nblks;
  register unsigned int siz;
  int oldmask;

#ifdef BSD
#ifndef BSD4_1
  int newmask = -1;
  /* Blocking these signals interferes with debugging, at least on BSD on
     the HP 9000/300.  */
#ifdef SIGTRAP
  newmask &= ~(1 << SIGTRAP);
#endif
#ifdef SIGILL
  newmask &= ~(1 << SIGILL);
#endif
#ifdef SIGTSTP
  newmask &= ~(1 << SIGTSTP);
#endif
#ifdef SIGSTOP
  newmask &= ~(1 << SIGSTOP);
#endif
  oldmask = sigsetmask (newmask);
#endif
#endif

#ifndef	WINDOWSNT
  if (!data_space_start)
    {
      data_space_start = start_of_data ();
    }
#endif	/* WINDOWSNT */

  if (lim_data == 0)
    get_lim_data ();

 /*
  * On initial startup, get two blocks of each size up to ALLOCATION_SIZE
  * bytes
  */
  if (!gotpool)
    { getpool (); getpool (); gotpool = 1; }

  /* Find current end of memory and issue warning if getting near max */

#ifndef	WINDOWSNT
#ifndef VMS
  /* Maximum virtual memory on VMS is difficult to calculate since it
   * depends on several dynmacially changing things. Also, alignment
   * isn't that important. That is why much of the code here is ifdef'ed
   * out for VMS systems.
   */
  cp = sbrk (0);
  siz = cp - data_space_start;

  if (warnfunction)
    switch (warnlevel)
      {
      case 0: 
	if (siz > (lim_data / 4) * 3)
	  {
	    warnlevel++;
	    (*warnfunction) ("Warning: past 75% of memory limit");
	  }
	break;
      case 1: 
	if (siz > (lim_data / 20) * 17)
	  {
	    warnlevel++;
	    (*warnfunction) ("Warning: past 85% of memory limit");
	  }
	break;
      case 2: 
	if (siz > (lim_data / 20) * 19)
	  {
	    warnlevel++;
	    (*warnfunction) ("Warning: past 95% of memory limit");
	  }
	break;
      }

  if ((int) cp & (ALLOCATION_SIZE - 1))	/* land on ALLOCATION_SIZE boundaries */
    sbrk (ALLOCATION_SIZE - ((int) cp & (ALLOCATION_SIZE - 1)));
#endif /* not VMS */
#endif /* WINDOWSNT */

  /* Take at least 2k, and figure out how many blocks of the desired size
     we're about to get */
  nblks = 1;
  if ((siz = nu) < 8)
    nblks = 1 << ((siz = 8) - nu);

#ifdef	WINDOWSNT
  if (!(cp = (char *)GlobalAlloc(GMEM_FIXED | GMEM_NOCOMPACT, 1 << (siz + 3))))
#else /* !WINDOWSNT */
  if ((cp = sbrk(1 << (siz + 3))) == (char *)-1)
#endif /* !WINDOWSNT */
    {
#ifdef BSD
#ifndef BSD4_1
#ifndef	WINDOWSNT
      sigsetmask (oldmask);
#endif	/* !WINDOWSNT */
#endif
#endif
      return;			/* no more room! */
    }
  malloc_sbrk_used = siz;
  malloc_sbrk_unused = lim_data - siz;

#ifndef VMS
  if ((int) cp & 7)
    {		/* shouldn't happen, but just in case */
      cp = (char *) (((int) cp + 8) & ~7);
      nblks--;
    }
#endif /* not VMS */

 /* save new header and link the nblks blocks together */
  nextf[nu] = (struct mhead *) cp;
  siz = 1 << (nu + 3);
  while (1)
    {
      ((struct mhead *) cp) -> mh_alloc = ISFREE;
      ((struct mhead *) cp) -> mh_index = nu;
      if (--nblks <= 0) break;
      CHAIN ((struct mhead *) cp) = (struct mhead *) (cp + siz);
      cp += siz;
    }
  CHAIN ((struct mhead *) cp) = 0;

#ifdef BSD
#ifndef BSD4_1
  sigsetmask (oldmask);
#endif
#endif
}

static void
getpool ()
{
  register int nu;
  char * sbrk ();
#ifdef WINDOWSNT
	register char *cp;
/* What assumptions are made about the memory between _malloc_base and
   sbrk(0)? (TimF@microsoft.com) */
#else /* !WINDOWSNT */
  register char *cp = sbrk (0);

  if ((int) cp & (ALLOCATION_SIZE - 1))	/* land on ALLOCATION_SIZE boundaries */
    sbrk (ALLOCATION_SIZE - ((int) cp & (ALLOCATION_SIZE - 1)));

  /* Record address of start of space allocated by malloc.  */
  if (_malloc_base == 0)
    _malloc_base = cp;
#endif /* !WINDOWSNT */

  /* Get (ALLOCATION_SIZE * 2) bytes of storage */
#ifdef	WINDOWSNT
	cp = (char *)GlobalAlloc(GMEM_FIXED | GMEM_NOCOMPACT, ALLOCATION_SIZE);

	if (!cp)
		return;
#else /* !WINDOWSNT */
  cp = sbrk (ALLOCATION_SIZE * 2);
  if (cp == (char *) -1)
    return;
#endif /* !WINDOWSNT */

  /* Divide it into an initial 8-word block
     plus one block of size 2**nu for nu = 3 ... 10.  */

  CHAIN (cp) = nextf[0];
  nextf[0] = (struct mhead *) cp;
  ((struct mhead *) cp) -> mh_alloc = ISFREE;
  ((struct mhead *) cp) -> mh_index = 0;
  cp += 8;

  for (nu = 0; nu < 7; nu++)
    {
      CHAIN (cp) = nextf[nu];
      nextf[nu] = (struct mhead *) cp;
      ((struct mhead *) cp) -> mh_alloc = ISFREE;
      ((struct mhead *) cp) -> mh_index = nu;
      cp += 8 << nu;
    }
}

char *
malloc (n)		/* get a block */
     unsigned n;
{
  register struct mhead *p;
  register unsigned int nbytes;
  register int nunits = 0;

  /* Figure out how many bytes are required, rounding up to the nearest
     multiple of 8, then figure out which nestf[] area to use.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区四区亚洲| 欧美精品一区二区在线观看| 国产精品18久久久久| 日本大胆欧美人术艺术动态| 亚洲成av人在线观看| 亚洲综合成人网| 亚洲综合一二区| 亚洲一卡二卡三卡四卡| 亚洲一区二区三区小说| 亚洲一级二级在线| 视频一区二区欧美| 热久久免费视频| 精品一区二区三区免费观看| 久久机这里只有精品| 国产一区欧美日韩| 成人在线综合网站| 91女人视频在线观看| 欧美日韩国产在线观看| 91精品国产高清一区二区三区| 欧美老肥妇做.爰bbww视频| 日韩三级电影网址| 国产午夜精品一区二区三区嫩草| 国产亚洲精品aa午夜观看| 国产精品美女久久福利网站 | 亚洲日本免费电影| 综合精品久久久| 亚州成人在线电影| 国产精品一区二区视频| 91在线你懂得| 欧美一三区三区四区免费在线看| 久久综合色8888| 亚洲欧洲精品成人久久奇米网| 亚洲制服欧美中文字幕中文字幕| 石原莉奈在线亚洲三区| 国产精品一区免费视频| 97久久精品人人爽人人爽蜜臀| 欧美日韩国产高清一区二区三区| 日韩免费高清电影| 亚洲婷婷国产精品电影人久久| 日韩高清不卡一区二区| 欧洲av一区二区嗯嗯嗯啊| 91麻豆精品国产91久久久使用方法 | 久久久精品综合| 国产中文字幕一区| 99re6这里只有精品视频在线观看| 欧美色视频一区| 国产精品理论片在线观看| 视频一区视频二区在线观看| 99久久99久久精品免费观看 | 亚洲丝袜另类动漫二区| 日本午夜一区二区| 色婷婷久久久综合中文字幕| 精品国产一区二区三区不卡| 午夜精品久久久久| 99在线精品一区二区三区| 久久综合狠狠综合久久激情| 午夜精品久久久久久久99樱桃| 成人午夜电影小说| 精品国产一区二区三区久久久蜜月| 亚洲在线视频一区| 91影院在线观看| 国产女人18毛片水真多成人如厕 | 欧美国产一区视频在线观看| 日本不卡1234视频| 欧美片在线播放| 一区二区国产视频| 99久久99久久精品免费看蜜桃| 久久免费偷拍视频| 精品一区二区三区在线播放| 91精品久久久久久久91蜜桃| 亚洲午夜久久久久| 欧美伊人久久久久久久久影院| 椎名由奈av一区二区三区| av成人动漫在线观看| 国产香蕉久久精品综合网| 国产一区二区不卡老阿姨| 日韩精品资源二区在线| 麻豆免费精品视频| 精品福利二区三区| 国产麻豆精品在线| 国产清纯白嫩初高生在线观看91| 国产精品2024| 1024精品合集| 欧美制服丝袜第一页| 午夜免费欧美电影| 日韩一区二区三区在线| 狂野欧美性猛交blacked| 久久毛片高清国产| 大胆亚洲人体视频| 亚洲欧美偷拍另类a∨色屁股| 在线视频观看一区| 日韩国产精品久久久| 日韩一区国产二区欧美三区| 精品无码三级在线观看视频| 欧美激情一区二区三区蜜桃视频| av电影在线观看一区| 午夜成人在线视频| 精品少妇一区二区三区视频免付费 | 成人高清视频免费观看| 亚洲精品一卡二卡| 欧美肥妇毛茸茸| 国产精品影视网| 亚洲一区二区视频| 精品国产乱码久久久久久夜甘婷婷| 国产69精品久久99不卡| 一区二区三区欧美日| 日韩免费高清av| 91网站在线播放| 日韩国产欧美视频| 17c精品麻豆一区二区免费| 欧美日韩亚洲高清一区二区| 国产精品亚洲一区二区三区妖精 | 99在线精品观看| 日韩精品视频网站| 久久婷婷色综合| 欧美三级电影一区| 国产伦精品一区二区三区免费| 亚洲私人黄色宅男| 久久美女高清视频| 欧美精品一级二级| av福利精品导航| 精品一区二区三区免费观看| 亚洲一级不卡视频| 国产亚洲欧美一区在线观看| 精品视频1区2区3区| 波多野结衣的一区二区三区| 蜜臀久久99精品久久久久宅男| 亚洲少妇30p| 日本一区二区三区免费乱视频 | 精品一区二区三区视频在线观看 | 免费成人深夜小野草| 亚洲欧美日韩精品久久久久| 欧美精品一区二区三区四区| 欧美日韩mp4| 色乱码一区二区三区88| 国产精品一区专区| 黄色小说综合网站| 日韩精品高清不卡| 亚洲影视在线播放| 《视频一区视频二区| 国产欧美一区二区精品婷婷| 精品日韩在线一区| 91精品国产黑色紧身裤美女| 欧美三区免费完整视频在线观看| 成人手机电影网| 国产成人亚洲精品狼色在线| 精品在线播放免费| 紧缚捆绑精品一区二区| 久久99精品久久只有精品| 日本vs亚洲vs韩国一区三区二区 | 国产无遮挡一区二区三区毛片日本| 欧美美女激情18p| 欧美三级日韩三级国产三级| 欧美吞精做爰啪啪高潮| 色吧成人激情小说| 91成人在线观看喷潮| 91久久精品一区二区三| 色综合天天综合网天天狠天天| 99视频在线精品| 一本到三区不卡视频| 一本色道亚洲精品aⅴ| 91传媒视频在线播放| 欧美少妇性性性| 日韩欧美激情四射| 久久久噜噜噜久噜久久综合| 国产女人水真多18毛片18精品视频 | 精品一区二区三区免费播放| 久久精品国产色蜜蜜麻豆| 国产精品一区二区三区四区| 成人一区在线观看| 91在线视频观看| 91麻豆精品国产91久久久 | 成人丝袜视频网| 99精品欧美一区| 欧美日本在线播放| 欧美二区在线观看| 精品少妇一区二区三区在线视频 | 色综合欧美在线视频区| 91久久久免费一区二区| 欧美一级在线免费| 亚洲国产精品高清| 亚洲图片欧美一区| 久久91精品久久久久久秒播| 成人av电影观看| 8x8x8国产精品| 久久久久久免费毛片精品| 亚洲精品久久久久久国产精华液| 亚洲国产综合在线| 国产精品资源站在线| 97se亚洲国产综合在线| 欧美一区二区三区的| 亚洲国产精品t66y| 天天免费综合色| 风间由美一区二区av101| 欧美在线综合视频| 亚洲国产精品99久久久久久久久| 亚洲444eee在线观看| 成人国产精品免费观看动漫| 日韩欧美国产三级| 亚洲欧美日本在线|