当前位置: 首页 > news >正文

网站开发违法/360网站安全检测

网站开发违法,360网站安全检测,用手机做网站好学吗,潍坊建设网站我个人的理解:其实质,和Java里的Hash表有点类似。在C语言中是为了解决数组无法扩展的缺陷。 例子: 看 PostgreSQL对 VFD的处理: 初始化: /** Virtual File Descriptor array pointer and size. This grows as* need…

我个人的理解:其实质,和Java里的Hash表有点类似。在C语言中是为了解决数组无法扩展的缺陷。

例子:

看 PostgreSQL对 VFD的处理:

初始化:

复制代码
/** Virtual File Descriptor array pointer and size.    This grows as* needed.    'File' values are indexes into this array.* Note that VfdCache[0] is not a usable VFD, just a list header.*/
static Vfd *VfdCache;
static Size SizeVfdCache = 0;
复制代码
复制代码
/** InitFileAccess --- initialize this module during backend startup** This is called during either normal or standalone backend start.* It is *not* called in the postmaster.*/
void
InitFileAccess(void)
{Assert(SizeVfdCache == 0);    /* call me only once *//* initialize cache header entry *////#### VfdCache = (Vfd *) malloc(sizeof(Vfd));if (VfdCache == NULL)ereport(FATAL,(errcode(ERRCODE_OUT_OF_MEMORY),errmsg("out of memory")));MemSet((char *) &(VfdCache[0]), 0, sizeof(Vfd));VfdCache->fd = VFD_CLOSED;SizeVfdCache = 1;/* register proc-exit hook to ensure temp files are dropped at exit */on_proc_exit(AtProcExit_Files, 0);
}
复制代码

扩展:

复制代码
static File
AllocateVfd(void)
{Index        i;File        file;DO_DB(elog(LOG, "AllocateVfd. Size %lu", SizeVfdCache));Assert(SizeVfdCache > 0);    /* InitFileAccess not called? */if (VfdCache[0].nextFree == 0){/** The free list is empty so it is time to increase the size of the* array.  We choose to double it each time this happens. However,* there's not much point in starting *real* small.*/Size        newCacheSize = SizeVfdCache * 2;Vfd           *newVfdCache;if (newCacheSize < 32)newCacheSize = 32;////####/** Be careful not to clobber VfdCache ptr if realloc fails.*/newVfdCache = (Vfd *) realloc(VfdCache, sizeof(Vfd) * newCacheSize);if (newVfdCache == NULL)ereport(ERROR,(errcode(ERRCODE_OUT_OF_MEMORY),errmsg("out of memory")));VfdCache = newVfdCache;/** Initialize the new entries and link them into the free list.*/for (i = SizeVfdCache; i < newCacheSize; i++){MemSet((char *) &(VfdCache[i]), 0, sizeof(Vfd));VfdCache[i].nextFree = i + 1;VfdCache[i].fd = VFD_CLOSED;}VfdCache[newCacheSize - 1].nextFree = 0;VfdCache[0].nextFree = SizeVfdCache;/** Record the new size*/SizeVfdCache = newCacheSize;}file = VfdCache[0].nextFree;VfdCache[0].nextFree = VfdCache[file].nextFree;return file;
}
复制代码





本文转自健哥的数据花园博客园博客,原文链接:http://www.cnblogs.com/gaojian/archive/2013/05/24/3096170.html,如需转载请自行联系原作者
http://www.jmfq.cn/news/4756339.html

相关文章:

  • 厦门最早做网站的公司/seo全称是什么
  • 罗田网站建设/微博seo排名优化
  • 佛山公司网站建设价格/网上推广企业
  • vps网站被镜像/100%上热门文案
  • 网站服务器系统盘满了怎么清理/网站seo是啥
  • 网站加v怎么做/网站运营公司
  • 网站建设需求说明书/百度推广获客
  • 天眼查企业信息查询平台官网/安卓优化清理大师
  • js获取网站广告点击量怎么做/魔贝课凡seo课程好吗
  • 查公司信息的国家网站/广告推广代运营公司
  • 优化型网站建设的基本要求/网店推广的作用是
  • 主流网站/网络广告电话
  • 企业建设网站方案/百度投放广告流程
  • 湖南大型网站建设/怎样制作网页新手自学入门
  • 咋做网站/广告营销是做什么的
  • 某商贸网站建设方案/网络推广用什么软件好
  • 河南高端网站建设/百度推广开户需要多少钱
  • 有域名了怎么建立网站/百度推广电话
  • 烟台建站价格/今日十大热点新闻头条
  • 福州网站怎么做的/厦门网站流量优化价格
  • 做一个赚钱的网站/短视频培训
  • 百度网站建设目标/风云榜小说排行榜
  • 网站开发用什么服务器/如何看待百度竞价排名
  • 阳泉那有做网站的/凡科建站怎么用
  • wordpress建站方向/新闻热点事件
  • 网站制作明细报价表/河北seo人员
  • wordpress新浪图/班级优化大师免费下载安装
  • 深圳做网站最好的公/深圳sem竞价托管
  • 李志自己做网站/我想在百度发布信息
  • 小程序开发教程下载/太原百度seo