puzze 2014.07.12
来源:互联网 发布:网络软文推广 编辑:程序博客网 时间:2024/06/07 05:37
come from URL:http://bugs.mysql.com/bug.php?id=73272
I have some puzzle to understand the code, if someone knows it works, please gives me some tips.
Description:Reduce two memset to one memset call for upd_create call.UNIV_INLINEupd_t*upd_create(/*=======*/ ulint n, /*!< in: number of fields */ mem_heap_t* heap) /*!< in: heap from which memory allocated */{ upd_t* update; update = (upd_t*) mem_heap_zalloc(heap, sizeof(upd_t)); update->n_fields = n; update->fields = (upd_field_t*) mem_heap_zalloc(heap, sizeof(upd_field_t) * n); return(update);}there is no need to use two mem_heap_zalloc call.How to repeat:N/ASuggested fix:diff -rc --exclude='*.orig' --exclude=sql_yacc.cc --exclude=sql_yacc.h mysql-5.6.19/storage/innobase/include/row0upd.ic mysql-5.6.19-patched/storage/innobase/include/row0upd.ic*** mysql-5.6.19/storage/innobase/include/row0upd.ic2014-05-06 18:45:59.000000000 +0800--- mysql-5.6.19-patched/storage/innobase/include/row0upd.ic2014-07-11 14:01:53.000000000 +0800****************** 44,54 **** { upd_t*update;! update = (upd_t*) mem_heap_zalloc(heap, sizeof(upd_t)); update->n_fields = n;! update->fields = (upd_field_t*)! mem_heap_zalloc(heap, sizeof(upd_field_t) * n); return(update); }--- 44,56 ---- { upd_t*update;! /* update = (upd_t*) mem_heap_zalloc(heap, sizeof(upd_t)); */! update = (upd_t*) mem_heap_zalloc(heap, sizeof(upd_t) + sizeof(upd_field_t) * n); update->n_fields = n;! /* update->fields = (upd_field_t*)! mem_heap_zalloc(heap, sizeof(upd_field_t) * n); */! update->fields = (upd_field_t*)(&update[1]); return(update); }
0 0
- puzze 2014.07.12
- 2014.07.12
- 2014.07
- 2014.07.07
- 【2014.07.06】
- 2014.07.10
- 【2014.07.14】
- 2014.07.15
- 2014.07.14笔记
- 2014.07.17基础知识笔记
- 2014.07.20笔记、多线程
- 2014.07.23 Oracle
- Uboot 2014.07 makefile分析
- Uboot 2014.07 makefile分析
- (2014.07.7-2014.07.13)七天的学习小记
- (2014.07.14-2014.07.20)七天的学习小记
- 2014.07.04 VS2008安装问题
- [Android学习日记]2014.07.23
- 【原创】《Linux设备驱动程序》学习之循序渐进 --- 时间、延迟及延缓操作
- 初始化的数值(int、double等)(一)
- usaco2.3.4货币系统
- 有关“类前置声明”和“包含头文件”的相关问题
- python手游服务端搭建
- puzze 2014.07.12
- 计算机网络学习心得(三)----物理层
- 【Unity 3D】学习笔记三十七:物理引擎——碰撞与休眠
- Android定时器实现的几种方式整理及removeCallbacks失效问题解决
- Servlet学习笔记(四)—— web.xml配置文件简介及加载过程
- l临行前的dfs。。。
- dsjhfjkdsjifkfdhgjkdfkhdshfghjjd
- 家的风格的肌肤过的记得发几个看得开
- 蠕动小虫,练习