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

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

?? hash.c

?? 這是一個嵌入式系統上運行的輕量級數據庫
?? C
字號:
/*** 2001 September 22**** 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 is the implementation of generic hash-tables** used in SQLite.**** $Id: hash.c,v 1.11 2004/01/08 02:17:33 drh Exp $*/#include "sqliteInt.h"#include <assert.h>/* Turn bulk memory into a hash table object by initializing the** fields of the Hash structure.**** "new" is a pointer to the hash table that is to be initialized.** keyClass is one of the constants SQLITE_HASH_INT, SQLITE_HASH_POINTER,** SQLITE_HASH_BINARY, or SQLITE_HASH_STRING.  The value of keyClass ** determines what kind of key the hash table will use.  "copyKey" is** true if the hash table should make its own private copy of keys and** false if it should just use the supplied pointer.  CopyKey only makes** sense for SQLITE_HASH_STRING and SQLITE_HASH_BINARY and is ignored** for other key classes.*/void sqliteHashInit(Hash *new, int keyClass, int copyKey){  assert( new!=0 );  assert( keyClass>=SQLITE_HASH_INT && keyClass<=SQLITE_HASH_BINARY );  new->keyClass = keyClass;  new->copyKey = copyKey &&                (keyClass==SQLITE_HASH_STRING || keyClass==SQLITE_HASH_BINARY);  new->first = 0;  new->count = 0;  new->htsize = 0;  new->ht = 0;}/* Remove all entries from a hash table.  Reclaim all memory.** Call this routine to delete a hash table or to reset a hash table** to the empty state.*/void sqliteHashClear(Hash *pH){  HashElem *elem;         /* For looping over all elements of the table */  assert( pH!=0 );  elem = pH->first;  pH->first = 0;  if( pH->ht ) sqliteFree(pH->ht);  pH->ht = 0;  pH->htsize = 0;  while( elem ){    HashElem *next_elem = elem->next;    if( pH->copyKey && elem->pKey ){      sqliteFree(elem->pKey);    }    sqliteFree(elem);    elem = next_elem;  }  pH->count = 0;}/*** Hash and comparison functions when the mode is SQLITE_HASH_INT*/static int intHash(const void *pKey, int nKey){  return nKey ^ (nKey<<8) ^ (nKey>>8);}static int intCompare(const void *pKey1, int n1, const void *pKey2, int n2){  return n2 - n1;}#if 0 /* NOT USED *//*** Hash and comparison functions when the mode is SQLITE_HASH_POINTER*/static int ptrHash(const void *pKey, int nKey){  uptr x = Addr(pKey);  return x ^ (x<<8) ^ (x>>8);}static int ptrCompare(const void *pKey1, int n1, const void *pKey2, int n2){  if( pKey1==pKey2 ) return 0;  if( pKey1<pKey2 ) return -1;  return 1;}#endif/*** Hash and comparison functions when the mode is SQLITE_HASH_STRING*/static int strHash(const void *pKey, int nKey){  return sqliteHashNoCase((const char*)pKey, nKey); }static int strCompare(const void *pKey1, int n1, const void *pKey2, int n2){  if( n1!=n2 ) return n2-n1;  return sqliteStrNICmp((const char*)pKey1,(const char*)pKey2,n1);}/*** Hash and comparison functions when the mode is SQLITE_HASH_BINARY*/static int binHash(const void *pKey, int nKey){  int h = 0;  const char *z = (const char *)pKey;  while( nKey-- > 0 ){    h = (h<<3) ^ h ^ *(z++);  }  return h & 0x7fffffff;}static int binCompare(const void *pKey1, int n1, const void *pKey2, int n2){  if( n1!=n2 ) return n2-n1;  return memcmp(pKey1,pKey2,n1);}/*** Return a pointer to the appropriate hash function given the key class.**** The C syntax in this function definition may be unfamilar to some ** programmers, so we provide the following additional explanation:**** The name of the function is "hashFunction".  The function takes a** single parameter "keyClass".  The return value of hashFunction()** is a pointer to another function.  Specifically, the return value** of hashFunction() is a pointer to a function that takes two parameters** with types "const void*" and "int" and returns an "int".*/static int (*hashFunction(int keyClass))(const void*,int){  switch( keyClass ){    case SQLITE_HASH_INT:     return &intHash;    /* case SQLITE_HASH_POINTER: return &ptrHash; // NOT USED */    case SQLITE_HASH_STRING:  return &strHash;    case SQLITE_HASH_BINARY:  return &binHash;;    default: break;  }  return 0;}/*** Return a pointer to the appropriate hash function given the key class.**** For help in interpreted the obscure C code in the function definition,** see the header comment on the previous function.*/static int (*compareFunction(int keyClass))(const void*,int,const void*,int){  switch( keyClass ){    case SQLITE_HASH_INT:     return &intCompare;    /* case SQLITE_HASH_POINTER: return &ptrCompare; // NOT USED */    case SQLITE_HASH_STRING:  return &strCompare;    case SQLITE_HASH_BINARY:  return &binCompare;    default: break;  }  return 0;}/* Resize the hash table so that it cantains "new_size" buckets.** "new_size" must be a power of 2.  The hash table might fail ** to resize if sqliteMalloc() fails.*/static void rehash(Hash *pH, int new_size){  struct _ht *new_ht;            /* The new hash table */  HashElem *elem, *next_elem;    /* For looping over existing elements */  HashElem *x;                   /* Element being copied to new hash table */  int (*xHash)(const void*,int); /* The hash function */  assert( (new_size & (new_size-1))==0 );  new_ht = (struct _ht *)sqliteMalloc( new_size*sizeof(struct _ht) );  if( new_ht==0 ) return;  if( pH->ht ) sqliteFree(pH->ht);  pH->ht = new_ht;  pH->htsize = new_size;  xHash = hashFunction(pH->keyClass);  for(elem=pH->first, pH->first=0; elem; elem = next_elem){    int h = (*xHash)(elem->pKey, elem->nKey) & (new_size-1);    next_elem = elem->next;    x = new_ht[h].chain;    if( x ){      elem->next = x;      elem->prev = x->prev;      if( x->prev ) x->prev->next = elem;      else          pH->first = elem;      x->prev = elem;    }else{      elem->next = pH->first;      if( pH->first ) pH->first->prev = elem;      elem->prev = 0;      pH->first = elem;    }    new_ht[h].chain = elem;    new_ht[h].count++;  }}/* This function (for internal use only) locates an element in an** hash table that matches the given key.  The hash for this key has** already been computed and is passed as the 4th parameter.*/static HashElem *findElementGivenHash(  const Hash *pH,     /* The pH to be searched */  const void *pKey,   /* The key we are searching for */  int nKey,  int h               /* The hash for this key. */){  HashElem *elem;                /* Used to loop thru the element list */  int count;                     /* Number of elements left to test */  int (*xCompare)(const void*,int,const void*,int);  /* comparison function */  if( pH->ht ){    elem = pH->ht[h].chain;    count = pH->ht[h].count;    xCompare = compareFunction(pH->keyClass);    while( count-- && elem ){      if( (*xCompare)(elem->pKey,elem->nKey,pKey,nKey)==0 ){         return elem;      }      elem = elem->next;    }  }  return 0;}/* Remove a single entry from the hash table given a pointer to that** element and a hash on the element's key.*/static void removeElementGivenHash(  Hash *pH,         /* The pH containing "elem" */  HashElem* elem,   /* The element to be removed from the pH */  int h             /* Hash value for the element */){  if( elem->prev ){    elem->prev->next = elem->next;   }else{    pH->first = elem->next;  }  if( elem->next ){    elem->next->prev = elem->prev;  }  if( pH->ht[h].chain==elem ){    pH->ht[h].chain = elem->next;  }  pH->ht[h].count--;  if( pH->ht[h].count<=0 ){    pH->ht[h].chain = 0;  }  if( pH->copyKey && elem->pKey ){    sqliteFree(elem->pKey);  }  sqliteFree( elem );  pH->count--;}/* Attempt to locate an element of the hash table pH with a key** that matches pKey,nKey.  Return the data for this element if it is** found, or NULL if there is no match.*/void *sqliteHashFind(const Hash *pH, const void *pKey, int nKey){  int h;             /* A hash on key */  HashElem *elem;    /* The element that matches key */  int (*xHash)(const void*,int);  /* The hash function */  if( pH==0 || pH->ht==0 ) return 0;  xHash = hashFunction(pH->keyClass);  assert( xHash!=0 );  h = (*xHash)(pKey,nKey);  assert( (pH->htsize & (pH->htsize-1))==0 );  elem = findElementGivenHash(pH,pKey,nKey, h & (pH->htsize-1));  return elem ? elem->data : 0;}/* Insert an element into the hash table pH.  The key is pKey,nKey** and the data is "data".**** If no element exists with a matching key, then a new** element is created.  A copy of the key is made if the copyKey** flag is set.  NULL is returned.**** If another element already exists with the same key, then the** new data replaces the old data and the old data is returned.** The key is not copied in this instance.  If a malloc fails, then** the new data is returned and the hash table is unchanged.**** If the "data" parameter to this function is NULL, then the** element corresponding to "key" is removed from the hash table.*/void *sqliteHashInsert(Hash *pH, const void *pKey, int nKey, void *data){  int hraw;             /* Raw hash value of the key */  int h;                /* the hash of the key modulo hash table size */  HashElem *elem;       /* Used to loop thru the element list */  HashElem *new_elem;   /* New element added to the pH */  int (*xHash)(const void*,int);  /* The hash function */  assert( pH!=0 );  xHash = hashFunction(pH->keyClass);  assert( xHash!=0 );  hraw = (*xHash)(pKey, nKey);  assert( (pH->htsize & (pH->htsize-1))==0 );  h = hraw & (pH->htsize-1);  elem = findElementGivenHash(pH,pKey,nKey,h);  if( elem ){    void *old_data = elem->data;    if( data==0 ){      removeElementGivenHash(pH,elem,h);    }else{      elem->data = data;    }    return old_data;  }  if( data==0 ) return 0;  new_elem = (HashElem*)sqliteMalloc( sizeof(HashElem) );  if( new_elem==0 ) return data;  if( pH->copyKey && pKey!=0 ){    new_elem->pKey = sqliteMallocRaw( nKey );    if( new_elem->pKey==0 ){      sqliteFree(new_elem);      return data;    }    memcpy((void*)new_elem->pKey, pKey, nKey);  }else{    new_elem->pKey = (void*)pKey;  }  new_elem->nKey = nKey;  pH->count++;  if( pH->htsize==0 ) rehash(pH,8);  if( pH->htsize==0 ){    pH->count = 0;    sqliteFree(new_elem);    return data;  }  if( pH->count > pH->htsize ){    rehash(pH,pH->htsize*2);  }  assert( (pH->htsize & (pH->htsize-1))==0 );  h = hraw & (pH->htsize-1);  elem = pH->ht[h].chain;  if( elem ){    new_elem->next = elem;    new_elem->prev = elem->prev;    if( elem->prev ){ elem->prev->next = new_elem; }    else            { pH->first = new_elem; }    elem->prev = new_elem;  }else{    new_elem->next = pH->first;    new_elem->prev = 0;    if( pH->first ){ pH->first->prev = new_elem; }    pH->first = new_elem;  }  pH->ht[h].count++;  pH->ht[h].chain = new_elem;  new_elem->data = data;  return 0;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩1234| 91丨国产丨九色丨pron| 亚洲香肠在线观看| 中文字幕一区二区三区在线不卡| 精品女同一区二区| 精品国产网站在线观看| 久久综合久久综合亚洲| 久久久久免费观看| 中文字幕av一区二区三区免费看 | www.激情成人| 成人app软件下载大全免费| av在线播放不卡| 一本久久a久久免费精品不卡| 色综合天天视频在线观看| 欧美性做爰猛烈叫床潮| 欧美人与z0zoxxxx视频| 欧美一卡二卡在线观看| 精品99999| 中文字幕五月欧美| 香蕉久久一区二区不卡无毒影院| 亚洲自拍偷拍网站| 蜜臀av亚洲一区中文字幕| 毛片基地黄久久久久久天堂| 国产很黄免费观看久久| voyeur盗摄精品| 欧美群妇大交群中文字幕| 日韩精品一区二区三区蜜臀 | 亚洲三级在线看| 亚洲国产精品自拍| 免费高清视频精品| 不卡的电视剧免费网站有什么| 色94色欧美sute亚洲线路一ni| 欧美美女视频在线观看| 久久午夜羞羞影院免费观看| 自拍偷自拍亚洲精品播放| 秋霞午夜av一区二区三区| 懂色av噜噜一区二区三区av| 欧美日韩在线一区二区| 国产欧美日韩在线观看| 一区二区三区电影在线播| 韩国精品一区二区| 在线观看免费视频综合| 久久精品欧美一区二区三区麻豆| 亚洲六月丁香色婷婷综合久久 | 久久在线免费观看| 一区二区国产视频| 国产成人av影院| 91精品国产综合久久福利软件| 国产精品丝袜一区| 久久草av在线| 欧美日韩在线一区二区| 中文一区二区完整视频在线观看| 人人爽香蕉精品| 91福利国产成人精品照片| 国产区在线观看成人精品| 天天综合网天天综合色| 日本精品一级二级| 中文乱码免费一区二区| 国产最新精品免费| 制服.丝袜.亚洲.另类.中文| 亚洲综合av网| 色88888久久久久久影院按摩| 国产午夜久久久久| 国产一区二区三区免费播放| 在线综合+亚洲+欧美中文字幕| 成人免费视频在线观看| 懂色av噜噜一区二区三区av| 久久精品亚洲麻豆av一区二区 | 国产黄色精品网站| 精品国产人成亚洲区| 久久电影国产免费久久电影| 欧美精品在线一区二区| 亚洲综合一区二区精品导航| 97久久精品人人澡人人爽| 欧美国产一区二区在线观看| 国产精品一区免费视频| 久久青草欧美一区二区三区| 国产在线麻豆精品观看| 2023国产一二三区日本精品2022| 秋霞午夜鲁丝一区二区老狼| 欧美一级黄色大片| 久久成人羞羞网站| www精品美女久久久tv| 国产.欧美.日韩| 国产精品久久久久精k8| 91女神在线视频| 亚洲制服丝袜av| 91精品国产色综合久久ai换脸| 日本不卡一二三区黄网| 日韩免费观看高清完整版在线观看| 久久成人羞羞网站| 久久久99久久精品欧美| 成人动漫在线一区| 亚洲高清视频在线| 欧美日韩高清一区二区| 麻豆精品国产91久久久久久| 久久亚洲一级片| 97久久精品人人做人人爽| 亚洲一区二区三区爽爽爽爽爽| 67194成人在线观看| 韩国视频一区二区| 亚洲少妇最新在线视频| 欧美日韩情趣电影| 国产一区二区三区电影在线观看| 国产女主播视频一区二区| 91浏览器打开| 热久久久久久久| 国产精品美女久久久久aⅴ国产馆| 99re6这里只有精品视频在线观看 99re8在线精品视频免费播放 | 中文字幕高清一区| 在线观看日产精品| 精品一区二区三区香蕉蜜桃| 欧美激情一区二区在线| 欧美性videosxxxxx| 国产在线一区二区综合免费视频| 亚洲日本在线天堂| 精品欧美一区二区在线观看| 成人av免费在线观看| 日本va欧美va瓶| 亚洲欧美日韩国产综合| 精品999在线播放| 欧美日韩一级黄| 不卡的av中国片| 激情五月婷婷综合网| 亚洲激情自拍视频| 欧美国产精品一区二区三区| 91精品国产美女浴室洗澡无遮挡| av一区二区三区在线| 国产伦精品一区二区三区在线观看| 一二三区精品视频| 国产精品萝li| 久久久久久久久伊人| 欧美一级一区二区| 欧美日韩日日骚| 91丨九色丨尤物| 成人网男人的天堂| 国模娜娜一区二区三区| 午夜电影久久久| 亚洲综合精品自拍| 亚洲免费观看高清完整版在线观看 | 色狠狠桃花综合| 北岛玲一区二区三区四区| 国产一区二区不卡| av影院午夜一区| 国产自产高清不卡| 美女视频一区二区| 奇米四色…亚洲| 日本欧美一区二区三区乱码| 性欧美大战久久久久久久久| 一区二区成人在线| 一个色综合av| 亚洲一区二区三区三| 亚洲自拍偷拍图区| 性做久久久久久免费观看| 亚洲国产日韩精品| 亚洲国产日韩精品| 日韩一区精品视频| 三级不卡在线观看| 久久精品久久久精品美女| 久久成人免费日本黄色| 国产精品白丝jk黑袜喷水| 国产福利91精品一区二区三区| 国产在线精品免费av| 懂色av中文字幕一区二区三区| 成人免费毛片a| 色哦色哦哦色天天综合| 欧美日韩亚洲国产综合| 宅男在线国产精品| 久久久久久久久久久久久女国产乱 | 日韩一本二本av| 精品国精品国产| 中文字幕亚洲综合久久菠萝蜜| 一区视频在线播放| 亚洲一区二区在线播放相泽| 午夜精品影院在线观看| 国模无码大尺度一区二区三区| 国产99久久久久| 欧美性猛交xxxxxxxx| 91精品国产综合久久久久| 久久精品日韩一区二区三区| 亚洲图片你懂的| 男人的天堂亚洲一区| 成人美女在线观看| 欧美视频在线观看一区| 欧美va亚洲va香蕉在线| 亚洲成人福利片| 久久精品72免费观看| 成人激情动漫在线观看| 欧美日韩久久久久久| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 精品污污网站免费看| 精品国免费一区二区三区| 亚洲欧美一区二区三区极速播放| 日韩精品亚洲专区| 成人免费毛片高清视频| 日韩一区二区免费在线电影| 18成人在线视频| 韩国毛片一区二区三区| 欧美日韩大陆一区二区| 欧美激情一区二区三区|