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

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

?? mem5.c

?? sqlite的最新源碼 This ZIP archive contains preprocessed C code for the SQLite library as individual sour
?? C
字號:
/*** 2007 October 14**** The author disclaims copyright to this source code.  In place of** a legal notice, here is a blessing:****    May you do good and not evil.**    May you find forgiveness for yourself and forgive others.**    May you share freely, never taking more than you give.***************************************************************************** This file contains the C functions that implement a memory** allocation subsystem for use by SQLite. **** This version of the memory allocation subsystem omits all** use of malloc(). The SQLite user supplies a block of memory** before calling sqlite3_initialize() from which allocations** are made and returned by the xMalloc() and xRealloc() ** implementations. Once sqlite3_initialize() has been called,** the amount of memory available to SQLite is fixed and cannot** be changed.**** This version of the memory allocation subsystem is included** in the build only if SQLITE_ENABLE_MEMSYS5 is defined.**** $Id: mem5.c,v 1.19 2008/11/19 16:52:44 danielk1977 Exp $*/#include "sqliteInt.h"/*** This version of the memory allocator is used only when ** SQLITE_ENABLE_MEMSYS5 is defined.*/#ifdef SQLITE_ENABLE_MEMSYS5/*** A minimum allocation is an instance of the following structure.** Larger allocations are an array of these structures where the** size of the array is a power of 2.*/typedef struct Mem5Link Mem5Link;struct Mem5Link {  int next;       /* Index of next free chunk */  int prev;       /* Index of previous free chunk */};/*** Maximum size of any allocation is ((1<<LOGMAX)*mem5.nAtom). Since** mem5.nAtom is always at least 8, this is not really a practical** limitation.*/#define LOGMAX 30/*** Masks used for mem5.aCtrl[] elements.*/#define CTRL_LOGSIZE  0x1f    /* Log2 Size of this block relative to POW2_MIN */#define CTRL_FREE     0x20    /* True if not checked out *//*** All of the static variables used by this module are collected** into a single structure named "mem5".  This is to keep the** static variables organized and to reduce namespace pollution** when this module is combined with other in the amalgamation.*/static SQLITE_WSD struct Mem5Global {  /*  ** Memory available for allocation  */  int nAtom;       /* Smallest possible allocation in bytes */  int nBlock;      /* Number of nAtom sized blocks in zPool */  u8 *zPool;    /*  ** Mutex to control access to the memory allocation subsystem.  */  sqlite3_mutex *mutex;  /*  ** Performance statistics  */  u64 nAlloc;         /* Total number of calls to malloc */  u64 totalAlloc;     /* Total of all malloc calls - includes internal frag */  u64 totalExcess;    /* Total internal fragmentation */  u32 currentOut;     /* Current checkout, including internal fragmentation */  u32 currentCount;   /* Current number of distinct checkouts */  u32 maxOut;         /* Maximum instantaneous currentOut */  u32 maxCount;       /* Maximum instantaneous currentCount */  u32 maxRequest;     /* Largest allocation (exclusive of internal frag) */    /*  ** Lists of free blocks of various sizes.  */  int aiFreelist[LOGMAX+1];  /*  ** Space for tracking which blocks are checked out and the size  ** of each block.  One byte per block.  */  u8 *aCtrl;} mem5 = { 19804167 };#define mem5 GLOBAL(struct Mem5Global, mem5)#define MEM5LINK(idx) ((Mem5Link *)(&mem5.zPool[(idx)*mem5.nAtom]))/*** Unlink the chunk at mem5.aPool[i] from list it is currently** on.  It should be found on mem5.aiFreelist[iLogsize].*/static void memsys5Unlink(int i, int iLogsize){  int next, prev;  assert( i>=0 && i<mem5.nBlock );  assert( iLogsize>=0 && iLogsize<=LOGMAX );  assert( (mem5.aCtrl[i] & CTRL_LOGSIZE)==iLogsize );  next = MEM5LINK(i)->next;  prev = MEM5LINK(i)->prev;  if( prev<0 ){    mem5.aiFreelist[iLogsize] = next;  }else{    MEM5LINK(prev)->next = next;  }  if( next>=0 ){    MEM5LINK(next)->prev = prev;  }}/*** Link the chunk at mem5.aPool[i] so that is on the iLogsize** free list.*/static void memsys5Link(int i, int iLogsize){  int x;  assert( sqlite3_mutex_held(mem5.mutex) );  assert( i>=0 && i<mem5.nBlock );  assert( iLogsize>=0 && iLogsize<=LOGMAX );  assert( (mem5.aCtrl[i] & CTRL_LOGSIZE)==iLogsize );  x = MEM5LINK(i)->next = mem5.aiFreelist[iLogsize];  MEM5LINK(i)->prev = -1;  if( x>=0 ){    assert( x<mem5.nBlock );    MEM5LINK(x)->prev = i;  }  mem5.aiFreelist[iLogsize] = i;}/*** If the STATIC_MEM mutex is not already held, obtain it now. The mutex** will already be held (obtained by code in malloc.c) if** sqlite3GlobalConfig.bMemStat is true.*/static void memsys5Enter(void){  if( sqlite3GlobalConfig.bMemstat==0 && mem5.mutex==0 ){    mem5.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);  }  sqlite3_mutex_enter(mem5.mutex);}static void memsys5Leave(void){  sqlite3_mutex_leave(mem5.mutex);}/*** Return the size of an outstanding allocation, in bytes.  The** size returned omits the 8-byte header overhead.  This only** works for chunks that are currently checked out.*/static int memsys5Size(void *p){  int iSize = 0;  if( p ){    int i = ((u8 *)p-mem5.zPool)/mem5.nAtom;    assert( i>=0 && i<mem5.nBlock );    iSize = mem5.nAtom * (1 << (mem5.aCtrl[i]&CTRL_LOGSIZE));  }  return iSize;}/*** Find the first entry on the freelist iLogsize.  Unlink that** entry and return its index. */static int memsys5UnlinkFirst(int iLogsize){  int i;  int iFirst;  assert( iLogsize>=0 && iLogsize<=LOGMAX );  i = iFirst = mem5.aiFreelist[iLogsize];  assert( iFirst>=0 );  while( i>0 ){    if( i<iFirst ) iFirst = i;    i = MEM5LINK(i)->next;  }  memsys5Unlink(iFirst, iLogsize);  return iFirst;}/*** Return a block of memory of at least nBytes in size.** Return NULL if unable.*/static void *memsys5MallocUnsafe(int nByte){  int i;           /* Index of a mem5.aPool[] slot */  int iBin;        /* Index into mem5.aiFreelist[] */  int iFullSz;     /* Size of allocation rounded up to power of 2 */  int iLogsize;    /* Log2 of iFullSz/POW2_MIN */  /* Keep track of the maximum allocation request.  Even unfulfilled  ** requests are counted */  if( (u32)nByte>mem5.maxRequest ){    mem5.maxRequest = nByte;  }  /* Round nByte up to the next valid power of two */  for(iFullSz=mem5.nAtom, iLogsize=0; iFullSz<nByte; iFullSz *= 2, iLogsize++){}  /* Make sure mem5.aiFreelist[iLogsize] contains at least one free  ** block.  If not, then split a block of the next larger power of  ** two in order to create a new free block of size iLogsize.  */  for(iBin=iLogsize; mem5.aiFreelist[iBin]<0 && iBin<=LOGMAX; iBin++){}  if( iBin>LOGMAX ) return 0;  i = memsys5UnlinkFirst(iBin);  while( iBin>iLogsize ){    int newSize;    iBin--;    newSize = 1 << iBin;    mem5.aCtrl[i+newSize] = CTRL_FREE | iBin;    memsys5Link(i+newSize, iBin);  }  mem5.aCtrl[i] = iLogsize;  /* Update allocator performance statistics. */  mem5.nAlloc++;  mem5.totalAlloc += iFullSz;  mem5.totalExcess += iFullSz - nByte;  mem5.currentCount++;  mem5.currentOut += iFullSz;  if( mem5.maxCount<mem5.currentCount ) mem5.maxCount = mem5.currentCount;  if( mem5.maxOut<mem5.currentOut ) mem5.maxOut = mem5.currentOut;  /* Return a pointer to the allocated memory. */  return (void*)&mem5.zPool[i*mem5.nAtom];}/*** Free an outstanding memory allocation.*/static void memsys5FreeUnsafe(void *pOld){  u32 size, iLogsize;  int iBlock;               /* Set iBlock to the index of the block pointed to by pOld in   ** the array of mem5.nAtom byte blocks pointed to by mem5.zPool.  */  iBlock = ((u8 *)pOld-mem5.zPool)/mem5.nAtom;  /* Check that the pointer pOld points to a valid, non-free block. */  assert( iBlock>=0 && iBlock<mem5.nBlock );  assert( ((u8 *)pOld-mem5.zPool)%mem5.nAtom==0 );  assert( (mem5.aCtrl[iBlock] & CTRL_FREE)==0 );  iLogsize = mem5.aCtrl[iBlock] & CTRL_LOGSIZE;  size = 1<<iLogsize;  assert( iBlock+size-1<(u32)mem5.nBlock );  mem5.aCtrl[iBlock] |= CTRL_FREE;  mem5.aCtrl[iBlock+size-1] |= CTRL_FREE;  assert( mem5.currentCount>0 );  assert( mem5.currentOut>=(size*mem5.nAtom) );  mem5.currentCount--;  mem5.currentOut -= size*mem5.nAtom;  assert( mem5.currentOut>0 || mem5.currentCount==0 );  assert( mem5.currentCount>0 || mem5.currentOut==0 );  mem5.aCtrl[iBlock] = CTRL_FREE | iLogsize;  while( iLogsize<LOGMAX ){    int iBuddy;    if( (iBlock>>iLogsize) & 1 ){      iBuddy = iBlock - size;    }else{      iBuddy = iBlock + size;    }    assert( iBuddy>=0 );    if( (iBuddy+(1<<iLogsize))>mem5.nBlock ) break;    if( mem5.aCtrl[iBuddy]!=(CTRL_FREE | iLogsize) ) break;    memsys5Unlink(iBuddy, iLogsize);    iLogsize++;    if( iBuddy<iBlock ){      mem5.aCtrl[iBuddy] = CTRL_FREE | iLogsize;      mem5.aCtrl[iBlock] = 0;      iBlock = iBuddy;    }else{      mem5.aCtrl[iBlock] = CTRL_FREE | iLogsize;      mem5.aCtrl[iBuddy] = 0;    }    size *= 2;  }  memsys5Link(iBlock, iLogsize);}/*** Allocate nBytes of memory*/static void *memsys5Malloc(int nBytes){  sqlite3_int64 *p = 0;  if( nBytes>0 ){    memsys5Enter();    p = memsys5MallocUnsafe(nBytes);    memsys5Leave();  }  return (void*)p; }/*** Free memory.*/static void memsys5Free(void *pPrior){  if( pPrior==0 ){assert(0);    return;  }  memsys5Enter();  memsys5FreeUnsafe(pPrior);  memsys5Leave();  }/*** Change the size of an existing memory allocation*/static void *memsys5Realloc(void *pPrior, int nBytes){  int nOld;  void *p;  if( pPrior==0 ){    return memsys5Malloc(nBytes);  }  if( nBytes<=0 ){    memsys5Free(pPrior);    return 0;  }  nOld = memsys5Size(pPrior);  if( nBytes<=nOld ){    return pPrior;  }  memsys5Enter();  p = memsys5MallocUnsafe(nBytes);  if( p ){    memcpy(p, pPrior, nOld);    memsys5FreeUnsafe(pPrior);  }  memsys5Leave();  return p;}/*** Round up a request size to the next valid allocation size.*/static int memsys5Roundup(int n){  int iFullSz;  for(iFullSz=mem5.nAtom; iFullSz<n; iFullSz *= 2);  return iFullSz;}static int memsys5Log(int iValue){  int iLog;  for(iLog=0; (1<<iLog)<iValue; iLog++);  return iLog;}/*** Initialize this module.*/static int memsys5Init(void *NotUsed){  int ii;  int nByte = sqlite3GlobalConfig.nHeap;  u8 *zByte = (u8 *)sqlite3GlobalConfig.pHeap;  int nMinLog;                 /* Log of minimum allocation size in bytes*/  int iOffset;  UNUSED_PARAMETER(NotUsed);  if( !zByte ){    return SQLITE_ERROR;  }  nMinLog = memsys5Log(sqlite3GlobalConfig.mnReq);  mem5.nAtom = (1<<nMinLog);  while( (int)sizeof(Mem5Link)>mem5.nAtom ){    mem5.nAtom = mem5.nAtom << 1;  }  mem5.nBlock = (nByte / (mem5.nAtom+sizeof(u8)));  mem5.zPool = zByte;  mem5.aCtrl = (u8 *)&mem5.zPool[mem5.nBlock*mem5.nAtom];  for(ii=0; ii<=LOGMAX; ii++){    mem5.aiFreelist[ii] = -1;  }  iOffset = 0;  for(ii=LOGMAX; ii>=0; ii--){    int nAlloc = (1<<ii);    if( (iOffset+nAlloc)<=mem5.nBlock ){      mem5.aCtrl[iOffset] = ii | CTRL_FREE;      memsys5Link(iOffset, ii);      iOffset += nAlloc;    }    assert((iOffset+nAlloc)>mem5.nBlock);  }  return SQLITE_OK;}/*** Deinitialize this module.*/static void memsys5Shutdown(void *NotUsed){  UNUSED_PARAMETER(NotUsed);  return;}/*** Open the file indicated and write a log of all unfreed memory ** allocations into that log.*/void sqlite3Memsys5Dump(const char *zFilename){#ifdef SQLITE_DEBUG  FILE *out;  int i, j, n;  int nMinLog;  if( zFilename==0 || zFilename[0]==0 ){    out = stdout;  }else{    out = fopen(zFilename, "w");    if( out==0 ){      fprintf(stderr, "** Unable to output memory debug output log: %s **\n",                      zFilename);      return;    }  }  memsys5Enter();  nMinLog = memsys5Log(mem5.nAtom);  for(i=0; i<=LOGMAX && i+nMinLog<32; i++){    for(n=0, j=mem5.aiFreelist[i]; j>=0; j = MEM5LINK(j)->next, n++){}    fprintf(out, "freelist items of size %d: %d\n", mem5.nAtom << i, n);  }  fprintf(out, "mem5.nAlloc       = %llu\n", mem5.nAlloc);  fprintf(out, "mem5.totalAlloc   = %llu\n", mem5.totalAlloc);  fprintf(out, "mem5.totalExcess  = %llu\n", mem5.totalExcess);  fprintf(out, "mem5.currentOut   = %u\n", mem5.currentOut);  fprintf(out, "mem5.currentCount = %u\n", mem5.currentCount);  fprintf(out, "mem5.maxOut       = %u\n", mem5.maxOut);  fprintf(out, "mem5.maxCount     = %u\n", mem5.maxCount);  fprintf(out, "mem5.maxRequest   = %u\n", mem5.maxRequest);  memsys5Leave();  if( out==stdout ){    fflush(stdout);  }else{    fclose(out);  }#else  UNUSED_PARAMETER(zFilename);#endif}/*** This routine is the only routine in this file with external ** linkage. It returns a pointer to a static sqlite3_mem_methods** struct populated with the memsys5 methods.*/const sqlite3_mem_methods *sqlite3MemGetMemsys5(void){  static const sqlite3_mem_methods memsys5Methods = {     memsys5Malloc,     memsys5Free,     memsys5Realloc,     memsys5Size,     memsys5Roundup,     memsys5Init,     memsys5Shutdown,     0  };  return &memsys5Methods;}#endif /* SQLITE_ENABLE_MEMSYS5 */

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99久久久久免费精品国产| 亚洲成av人片一区二区梦乃| 激情久久五月天| 精品国产乱码久久久久久浪潮| 蜜臀av性久久久久蜜臀aⅴ流畅 | 亚洲午夜免费电影| 欧美在线你懂得| 日本欧美一区二区三区| 欧美大片一区二区| 国产91精品精华液一区二区三区| 国产精品天天摸av网| 91女厕偷拍女厕偷拍高清| 亚洲一二三区不卡| 精品国产伦理网| yourporn久久国产精品| 亚洲国产欧美一区二区三区丁香婷| 欧美亚洲一区二区三区四区| 午夜精品福利在线| 久久久精品一品道一区| 95精品视频在线| 美国av一区二区| 国产精品二区一区二区aⅴ污介绍| 欧美自拍丝袜亚洲| 国模无码大尺度一区二区三区| 国产精品嫩草影院av蜜臀| 欧美日韩久久久久久| 国产最新精品免费| 亚洲精品国产第一综合99久久| 欧美日韩高清在线播放| 国产精品1024久久| 亚洲成av人片观看| 中文字幕第一区综合| 欧美区一区二区三区| 国产不卡免费视频| 婷婷久久综合九色综合绿巨人 | 久久精品一二三| 欧美性色欧美a在线播放| 精品一区二区三区视频| 亚洲精品一卡二卡| 久久久久久久免费视频了| 精品视频999| 成人一道本在线| 男女视频一区二区| 一区二区三区在线免费视频| 久久久久久久久99精品| 欧美精品一卡二卡| 色婷婷av一区二区三区之一色屋| 国产一区二区三区视频在线播放| 亚洲综合色婷婷| 亚洲国产成人私人影院tom| 6080日韩午夜伦伦午夜伦| gogogo免费视频观看亚洲一| 精品一区二区在线看| 亚洲aⅴ怡春院| 亚洲精品va在线观看| 国产色产综合产在线视频| 在线观看91av| 欧美色视频在线| 色婷婷综合久久久中文一区二区| 成人综合激情网| 国产一区二三区好的| 久久精品国产免费| 男女性色大片免费观看一区二区| 亚洲第一成人在线| 亚洲午夜视频在线观看| 亚洲免费看黄网站| 亚洲日本乱码在线观看| 国产欧美日韩在线视频| 天堂资源在线中文精品| 午夜精品爽啪视频| 成人晚上爱看视频| 免费人成黄页网站在线一区二区| 亚洲欧美国产毛片在线| 亚洲欧洲另类国产综合| 国产欧美日韩综合精品一区二区| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 中文字幕一区二区三区在线观看| 亚洲一区在线观看免费 | 日韩黄色片在线观看| 一区二区三区成人在线视频| 亚洲欧美色综合| 一区二区在线免费观看| 亚洲综合一区在线| 亚洲大尺度视频在线观看| 性欧美大战久久久久久久久| 丝袜亚洲另类欧美| 美女视频第一区二区三区免费观看网站| 亚洲va韩国va欧美va| 午夜精品福利视频网站| 视频一区中文字幕国产| 麻豆高清免费国产一区| 韩国视频一区二区| 成人性视频免费网站| 99久久久国产精品| 欧美午夜寂寞影院| 91精品国产乱| 久久久久亚洲蜜桃| 成人欧美一区二区三区1314| 亚洲精品国产品国语在线app| 亚洲第一会所有码转帖| 另类人妖一区二区av| 国产电影精品久久禁18| 91色|porny| 制服丝袜av成人在线看| 久久免费看少妇高潮| 国产精品电影院| 五月天国产精品| 国产一区免费电影| 色婷婷久久综合| 91麻豆精品国产综合久久久久久 | 韩国av一区二区| 99久久久精品| 日韩欧美综合一区| 国产精品久久久久久久久动漫| 亚洲综合免费观看高清完整版在线| 日韩**一区毛片| 成人午夜在线免费| 制服视频三区第一页精品| 中文欧美字幕免费| 日韩福利电影在线| 99综合电影在线视频| 日韩一区和二区| 亚洲欧美国产77777| 久久99国产乱子伦精品免费| bt7086福利一区国产| 欧美一区二区观看视频| 黄一区二区三区| 欧美系列亚洲系列| 久久久久综合网| 天天色 色综合| 91丝袜呻吟高潮美腿白嫩在线观看| 日韩午夜激情视频| 亚洲卡通动漫在线| 成人免费看视频| 精品日本一线二线三线不卡| 艳妇臀荡乳欲伦亚洲一区| 国产成人亚洲综合a∨婷婷图片 | 成人精品高清在线| 日韩欧美一区二区三区在线| 亚洲免费观看高清完整版在线观看熊| 美女视频网站久久| 欧美日韩国产成人在线免费| 亚洲欧美另类小说| 国产91丝袜在线播放| 日韩欧美国产综合一区| 亚洲成av人片一区二区| 色综合久久中文综合久久97| 国产亚洲欧洲一区高清在线观看| 偷拍一区二区三区四区| 在线视频综合导航| 中文字幕亚洲成人| 大胆亚洲人体视频| 久久精品一区四区| 国产精品中文字幕日韩精品| 欧美一区二区久久久| 亚欧色一区w666天堂| 欧洲一区在线电影| 亚洲天堂中文字幕| 不卡av免费在线观看| 国产欧美日韩麻豆91| 国产成人在线影院| 久久男人中文字幕资源站| 久久 天天综合| 日韩精品一区二区三区三区免费| 日韩一区精品字幕| 666欧美在线视频| 蜜乳av一区二区三区| 一区二区三区在线观看视频| av在线综合网| 亚洲免费资源在线播放| 91亚洲精华国产精华精华液| 国产精品视频第一区| 成人黄色网址在线观看| 中文字幕色av一区二区三区| 成人禁用看黄a在线| 自拍偷拍亚洲综合| 在线观看日韩电影| 香蕉av福利精品导航| 欧美日韩国产欧美日美国产精品| 亚洲一区二区在线免费看| 欧美在线你懂得| 日韩激情中文字幕| 精品欧美一区二区三区精品久久| 国内不卡的二区三区中文字幕 | 成人不卡免费av| 亚洲柠檬福利资源导航| 欧美三区在线视频| 麻豆一区二区三区| 国产肉丝袜一区二区| av电影在线不卡| 午夜久久久久久久久 | 国产丝袜欧美中文另类| jlzzjlzz亚洲日本少妇| 亚洲综合精品自拍| 精品日韩成人av| 91性感美女视频| 蜜臀av性久久久久蜜臀aⅴ流畅 | 久久99日本精品| 国产精品国产三级国产普通话蜜臀| 一道本成人在线|