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

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

?? dict.c

?? libxml,在UNIX/LINUX下非常重要的一個庫,為XML相關應用提供方便.目前上載的是最新版本,若要取得最新版本,請參考里面的readme.
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* * dict.c: dictionary of reusable strings, just used to avoid allocation *         and freeing operations. * * Copyright (C) 2003 Daniel Veillard. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER. * * Author: daniel@veillard.com */#define IN_LIBXML#include "libxml.h"#include <string.h>#include <libxml/tree.h>#include <libxml/dict.h>#include <libxml/xmlmemory.h>#include <libxml/xmlerror.h>#include <libxml/globals.h>#define MAX_HASH_LEN 4#define MIN_DICT_SIZE 128#define MAX_DICT_HASH 8 * 2048/* #define ALLOW_REMOVAL *//* #define DEBUG_GROW *//* * An entry in the dictionnary */typedef struct _xmlDictEntry xmlDictEntry;typedef xmlDictEntry *xmlDictEntryPtr;struct _xmlDictEntry {    struct _xmlDictEntry *next;    const xmlChar *name;    int len;    int valid;};typedef struct _xmlDictStrings xmlDictStrings;typedef xmlDictStrings *xmlDictStringsPtr;struct _xmlDictStrings {    xmlDictStringsPtr next;    xmlChar *free;    xmlChar *end;    int size;    int nbStrings;    xmlChar array[1];};/* * The entire dictionnary */struct _xmlDict {    int ref_counter;    xmlRMutexPtr mutex;    struct _xmlDictEntry *dict;    int size;    int nbElems;    xmlDictStringsPtr strings;    struct _xmlDict *subdict;};/* * A mutex for modifying the reference counter for shared * dictionaries. */static xmlRMutexPtr xmlDictMutex = NULL;/* * Whether the dictionary mutex was initialized. */static int xmlDictInitialized = 0;/** * xmlInitializeDict: * * Do the dictionary mutex initialization. * this function is not thread safe, initialization should * preferably be done once at startup */static int xmlInitializeDict(void) {    if (xmlDictInitialized)        return(1);    if ((xmlDictMutex = xmlNewRMutex()) == NULL)        return(0);    xmlDictInitialized = 1;    return(1);}/** * xmlDictCleanup: * * Free the dictionary mutex. */voidxmlDictCleanup(void) {    if (!xmlDictInitialized)        return;    xmlFreeRMutex(xmlDictMutex);    xmlDictInitialized = 0;}/* * xmlDictAddString: * @dict: the dictionnary * @name: the name of the userdata * @len: the length of the name, if -1 it is recomputed * * Add the string to the array[s] * * Returns the pointer of the local string, or NULL in case of error. */static const xmlChar *xmlDictAddString(xmlDictPtr dict, const xmlChar *name, int namelen) {    xmlDictStringsPtr pool;    const xmlChar *ret;    int size = 0; /* + sizeof(_xmlDictStrings) == 1024 */    pool = dict->strings;    while (pool != NULL) {	if (pool->end - pool->free > namelen)	    goto found_pool;	if (pool->size > size) size = pool->size;	pool = pool->next;    }    /*     * Not found, need to allocate     */    if (pool == NULL) {        if (size == 0) size = 1000;	else size *= 4; /* exponential growth */        if (size < 4 * namelen) 	    size = 4 * namelen; /* just in case ! */	pool = (xmlDictStringsPtr) xmlMalloc(sizeof(xmlDictStrings) + size);	if (pool == NULL)	    return(NULL);	pool->size = size;	pool->nbStrings = 0;	pool->free = &pool->array[0];	pool->end = &pool->array[size];	pool->next = dict->strings;	dict->strings = pool;    }found_pool:    ret = pool->free;    memcpy(pool->free, name, namelen);    pool->free += namelen;    *(pool->free++) = 0;    return(ret);}/* * xmlDictAddQString: * @dict: the dictionnary * @prefix: the prefix of the userdata * @name: the name of the userdata * @len: the length of the name, if -1 it is recomputed * * Add the QName to the array[s] * * Returns the pointer of the local string, or NULL in case of error. */static const xmlChar *xmlDictAddQString(xmlDictPtr dict, const xmlChar *prefix,                 const xmlChar *name, int namelen){    xmlDictStringsPtr pool;    const xmlChar *ret;    int size = 0; /* + sizeof(_xmlDictStrings) == 1024 */    int plen;    if (prefix == NULL) return(xmlDictAddString(dict, name, namelen));    plen = xmlStrlen(prefix);    pool = dict->strings;    while (pool != NULL) {	if (pool->end - pool->free > namelen)	    goto found_pool;	if (pool->size > size) size = pool->size;	pool = pool->next;    }    /*     * Not found, need to allocate     */    if (pool == NULL) {        if (size == 0) size = 1000;	else size *= 4; /* exponential growth */        if (size < 4 * namelen) 	    size = 4 * namelen; /* just in case ! */	pool = (xmlDictStringsPtr) xmlMalloc(sizeof(xmlDictStrings) + size);	if (pool == NULL)	    return(NULL);	pool->size = size;	pool->nbStrings = 0;	pool->free = &pool->array[0];	pool->end = &pool->array[size];	pool->next = dict->strings;	dict->strings = pool;    }found_pool:    ret = pool->free;    memcpy(pool->free, prefix, plen);    pool->free += plen;    *(pool->free++) = ':';    namelen -= plen + 1;    memcpy(pool->free, name, namelen);    pool->free += namelen;    *(pool->free++) = 0;    return(ret);}/* * xmlDictComputeKey: * Calculate the hash key */static unsigned longxmlDictComputeKey(const xmlChar *name, int namelen) {    unsigned long value = 0L;        if (name == NULL) return(0);    value = *name;    value <<= 5;    if (namelen > 10) {        value += name[namelen - 1];        namelen = 10;    }    switch (namelen) {        case 10: value += name[9];        case 9: value += name[8];        case 8: value += name[7];        case 7: value += name[6];        case 6: value += name[5];        case 5: value += name[4];        case 4: value += name[3];        case 3: value += name[2];        case 2: value += name[1];        default: break;    }    return(value);}/* * xmlDictComputeQKey: * Calculate the hash key */static unsigned longxmlDictComputeQKey(const xmlChar *prefix, const xmlChar *name, int len){    unsigned long value = 0L;    int plen;        if (prefix == NULL)        return(xmlDictComputeKey(name, len));    plen = xmlStrlen(prefix);    if (plen == 0)	value += 30 * (unsigned long) ':';    else	value += 30 * (*prefix);        if (len > 10) {        value += name[len - (plen + 1 + 1)];        len = 10;	if (plen > 10)	    plen = 10;    }    switch (plen) {        case 10: value += prefix[9];        case 9: value += prefix[8];        case 8: value += prefix[7];        case 7: value += prefix[6];        case 6: value += prefix[5];        case 5: value += prefix[4];        case 4: value += prefix[3];        case 3: value += prefix[2];        case 2: value += prefix[1];        case 1: value += prefix[0];        default: break;    }    len -= plen;    if (len > 0) {        value += (unsigned long) ':';	len--;    }    switch (len) {        case 10: value += name[9];        case 9: value += name[8];        case 8: value += name[7];        case 7: value += name[6];        case 6: value += name[5];        case 5: value += name[4];        case 4: value += name[3];        case 3: value += name[2];        case 2: value += name[1];        case 1: value += name[0];        default: break;    }    return(value);}/** * xmlDictCreate: * * Create a new dictionary * * Returns the newly created dictionnary, or NULL if an error occured. */xmlDictPtrxmlDictCreate(void) {    xmlDictPtr dict;    if (!xmlDictInitialized)        if (!xmlInitializeDict())            return(NULL);     dict = xmlMalloc(sizeof(xmlDict));    if (dict) {        dict->ref_counter = 1;        dict->size = MIN_DICT_SIZE;	dict->nbElems = 0;        dict->dict = xmlMalloc(MIN_DICT_SIZE * sizeof(xmlDictEntry));	dict->strings = NULL;	dict->subdict = NULL;        if (dict->dict) {            if ((dict->mutex = xmlNewRMutex()) != NULL) {                memset(dict->dict, 0, MIN_DICT_SIZE * sizeof(xmlDictEntry));                return(dict);            }            xmlFree(dict->dict);        }        xmlFree(dict);    }    return(NULL);}/** * xmlDictCreateSub: * @sub: an existing dictionnary * * Create a new dictionary, inheriting strings from the read-only * dictionnary @sub. On lookup, strings are first searched in the * new dictionnary, then in @sub, and if not found are created in the * new dictionnary. * * Returns the newly created dictionnary, or NULL if an error occured. */xmlDictPtrxmlDictCreateSub(xmlDictPtr sub) {    xmlDictPtr dict = xmlDictCreate();      if ((dict != NULL) && (sub != NULL)) {        dict->subdict = sub;	xmlDictReference(dict->subdict);    }    return(dict);}/** * xmlDictReference: * @dict: the dictionnary * * Increment the reference counter of a dictionary * * Returns 0 in case of success and -1 in case of error */intxmlDictReference(xmlDictPtr dict) {    if (!xmlDictInitialized)        if (!xmlInitializeDict())            return(-1);    if (dict == NULL) return -1;    xmlRMutexLock(xmlDictMutex);    dict->ref_counter++;    xmlRMutexUnlock(xmlDictMutex);    return(0);}/** * xmlDictGrow: * @dict: the dictionnary * @size: the new size of the dictionnary * * resize the dictionnary * * Returns 0 in case of success, -1 in case of failure */static intxmlDictGrow(xmlDictPtr dict, int size) {    unsigned long key;    int oldsize, i;    xmlDictEntryPtr iter, next;    struct _xmlDictEntry *olddict;#ifdef DEBUG_GROW    unsigned long nbElem = 0;#endif      if (dict == NULL)	return(-1);    if (size < 8)        return(-1);    if (size > 8 * 2048)	return(-1);    oldsize = dict->size;    olddict = dict->dict;    if (olddict == NULL)        return(-1);      dict->dict = xmlMalloc(size * sizeof(xmlDictEntry));    if (dict->dict == NULL) {	dict->dict = olddict;	return(-1);    }    memset(dict->dict, 0, size * sizeof(xmlDictEntry));    dict->size = size;    /*	If the two loops are merged, there would be situations where	a new entry needs to allocated and data copied into it from 	the main dict. So instead, we run through the array twice, first	copying all the elements in the main array (where we can't get	conflicts) and then the rest, so we only free (and don't allocate)    */    for (i = 0; i < oldsize; i++) {	if (olddict[i].valid == 0) 	    continue;	key = xmlDictComputeKey(olddict[i].name, olddict[i].len) % dict->size;	memcpy(&(dict->dict[key]), &(olddict[i]), sizeof(xmlDictEntry));	dict->dict[key].next = NULL;#ifdef DEBUG_GROW	nbElem++;#endif    }    for (i = 0; i < oldsize; i++) {	iter = olddict[i].next;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩一区二区三区高清| 高清在线观看日韩| 豆国产96在线|亚洲| 欧美肥胖老妇做爰| 亚洲一区二区三区四区不卡| 一本色道久久加勒比精品| 欧美激情一区在线| 国产成人av资源| 久久久久久久电影| 91精品久久久久久久99蜜桃| 欧美老年两性高潮| 一区二区三区欧美日| 色999日韩国产欧美一区二区| 欧美老年两性高潮| 日韩高清在线观看| 日韩一区二区麻豆国产| 蜜臀久久久99精品久久久久久| 91精品在线麻豆| 丝袜脚交一区二区| 91精品国产丝袜白色高跟鞋| 一区二区三区国产精品| 91久久免费观看| 亚洲一区成人在线| 欧美一级片在线看| 黑人巨大精品欧美黑白配亚洲| 26uuu亚洲| 精东粉嫩av免费一区二区三区| 欧美男同性恋视频网站| 蜜桃一区二区三区四区| 国产亚洲午夜高清国产拍精品 | www激情久久| 亚洲人成亚洲人成在线观看图片| 日韩国产精品大片| 色香蕉久久蜜桃| 亚洲一区二区免费视频| 色综合中文字幕| 91性感美女视频| 国产亚洲制服色| 不卡高清视频专区| 亚洲精品国久久99热| 精品视频在线免费看| 日本不卡视频一二三区| 国产欧美一区二区精品仙草咪| 91免费国产视频网站| 首页国产丝袜综合| 日韩一级高清毛片| 欧美精品一级二级三级| 亚洲特级片在线| 欧美日韩在线观看一区二区| 精品一区二区在线播放| 中文字幕一区二区三区不卡在线 | 色婷婷av一区| 丝袜美腿高跟呻吟高潮一区| 欧美国产一区在线| 欧美亚洲图片小说| 国产精品911| 亚洲福利一二三区| 国产精品免费久久久久| 欧美私模裸体表演在线观看| 国产精品18久久久久久久久 | 一区二区三区自拍| 日韩精品专区在线| 91免费国产视频网站| 国产精品亚洲а∨天堂免在线| 亚洲综合激情另类小说区| 久久久青草青青国产亚洲免观| 欧美日韩一区二区三区在线看| 蜜桃视频第一区免费观看| 亚洲日本一区二区三区| 日韩美女一区二区三区| 在线亚洲一区二区| 国产91在线|亚洲| 日韩成人一区二区| 一区二区三区四区视频精品免费| 久久久久久一二三区| 欧美精品一二三区| 日本电影亚洲天堂一区| 国产91在线看| 国产成人免费视频网站高清观看视频| 日韩精品欧美成人高清一区二区| 亚洲麻豆国产自偷在线| 国产精品免费视频一区| 欧美日韩国产123区| 91福利视频在线| 成人爱爱电影网址| 国产成人一区在线| 久久不见久久见免费视频1| 五月激情六月综合| 国产精品麻豆久久久| 欧美激情一区在线| 国产丝袜在线精品| 精品第一国产综合精品aⅴ| 欧美一区二区三区免费视频| 91丨九色丨蝌蚪富婆spa| 岛国一区二区在线观看| 国产成人激情av| 国产成人自拍网| 丁香桃色午夜亚洲一区二区三区| 日本不卡在线视频| 水野朝阳av一区二区三区| 亚洲成人你懂的| 亚洲福利视频一区二区| 1区2区3区精品视频| 国产精品国产自产拍在线| 亚洲欧美自拍偷拍| 日本一区二区三区四区| 中文一区二区完整视频在线观看| 国产精品理论在线观看| 久久久精品天堂| 精品福利视频一区二区三区| 久久女同互慰一区二区三区| 久久久夜色精品亚洲| 久久免费精品国产久精品久久久久| 精品国产91洋老外米糕| 日韩欧美一区二区久久婷婷| 欧美本精品男人aⅴ天堂| 国产人成亚洲第一网站在线播放| 国产精品久久久99| 亚洲人成亚洲人成在线观看图片| 亚洲午夜视频在线| 蜜桃一区二区三区在线| 丁香亚洲综合激情啪啪综合| 色老汉一区二区三区| 欧美成人r级一区二区三区| 国产精品久久久久久福利一牛影视 | 亚洲同性gay激情无套| 婷婷成人激情在线网| 成人高清免费在线播放| 欧美一区欧美二区| 国产精品久久久久久久蜜臀| 奇米色777欧美一区二区| 成人爱爱电影网址| 精品国产亚洲一区二区三区在线观看| 亚洲人精品午夜| 国产伦精品一区二区三区视频青涩 | 日韩一区二区免费在线电影| 中文字幕一区不卡| 久久精品国产精品亚洲综合| 欧美三级日韩三级国产三级| 国产精品色眯眯| 日本不卡123| 欧美在线视频全部完| 国产精品久久久久久久久晋中 | 美女免费视频一区| 国产日韩亚洲欧美综合| 日韩精品一区在线| 91视频在线观看| 高清在线成人网| 国产成人精品网址| 日韩西西人体444www| 一区二区在线观看免费视频播放| 国产成人精品在线看| 日韩精品一区二区三区视频播放 | 欧美精选在线播放| 亚洲精品国产视频| 成人精品鲁一区一区二区| 精品国内二区三区| 亚洲成人精品一区二区| 99久久久国产精品免费蜜臀| 国产精品女同一区二区三区| 国产盗摄视频一区二区三区| 日韩精品一区二区三区视频在线观看 | 日韩中文字幕1| 欧美日韩国产精品自在自线| 18欧美乱大交hd1984| 91香蕉视频mp4| 亚洲欧美在线观看| 一本一道综合狠狠老| 亚洲精品欧美综合四区| 97aⅴ精品视频一二三区| 中文字幕亚洲视频| 国产大陆a不卡| 亚洲欧洲日韩女同| 国产精品一区不卡| 白白色 亚洲乱淫| 青娱乐精品视频| 欧美视频日韩视频在线观看| 一区二区三区资源| 欧美日韩一区二区在线视频| 午夜精品久久久久影视| 欧美一区二区啪啪| 久久精品av麻豆的观看方式| 26uuu成人网一区二区三区| 国产一区啦啦啦在线观看| 久久精品人人做人人综合 | 蜜臀va亚洲va欧美va天堂| 欧美大片免费久久精品三p| 麻豆精品一区二区三区| 日韩欧美一级二级三级| 国产一区二区不卡| 国产喷白浆一区二区三区| 国产99精品国产| 洋洋av久久久久久久一区| 欧美午夜电影网| 奇米四色…亚洲| 国产无一区二区| 在线观看一区不卡| 美女视频一区在线观看| 国产色爱av资源综合区| 94色蜜桃网一区二区三区|