????MySQL?У??????????Щ????????????????????磺DYNAMIC_STRING??
???????????????????????????????????????????????????????????????????μ???棬????????????MySQL?????DYNAMIC_STRING?????涯?????????????:
????typedef struct st_dynamic_string
????{
????char*str;
????size_tlength?? max_length?? alloc_increment;
????} DYNAMIC_STRING;
??????????????У?str?洢????????????????length?????????????????max_length?????????????????????????????alloc_increment?????????????????????????η????????檔
???????濴??????????????????:
my_bool init_dynamic_string( DYNAMIC_STRING *str?? const char *init_str?? size_t init_alloc?? size_t alloc_increment )
{
size_t length;
DBUG_ENTER( "init_dynamic_string" );
if ( !alloc_increment )
alloc_increment = 128;
length = 1;
if ( init_str && (length = strlen( init_str ) + 1) < init_alloc )
init_alloc = ( (length + alloc_increment - 1) / alloc_increment) * alloc_increment;
if ( !init_alloc )
init_alloc = alloc_increment;
if ( !(str->str = (char *) my_malloc( init_alloc?? MYF( MY_WME ) ) ) )
DBUG_RETURN( TRUE );
str->length = length - 1;
if ( init_str )
memcpy( str->str?? init_str?? length );
str->max_length= init_alloc;
str->alloc_increment= alloc_increment;
DBUG_RETURN( FALSE );
}
????????????????????????????????????????????????????Сinit_alloc???????????????????????ж?????????DYNAMIC_STRING??????????????????????С???????????????????alloc_increment?????????
????length:?????????????
????max_length:???????????
????alloc_increment:?????????′η???????????С.
???????????Щ???????????′????????????????????????????????Щ????ж????????????????????
my_bool dynstr_append_mem( DYNAMIC_STRING *str?? const char *append?? size_t length )
{
char *new_ptr;
if ( str->length + length >= str->max_length ) /* ??????????????????????????????С */
{
/* ???????????alloc_increment ??С????棬??????????????????? */
size_t new_length = (str->length + length + str->alloc_increment) /
str->alloc_increment;
new_length *= str->alloc_increment;
if ( !(new_ptr = (char *) my_realloc( str->str?? new_length?? MYF( MY_WME ) ) ) )
return(TRUE);
str->str= new_ptr;
str->max_length = new_length;
}
/* ???·?????????append??str??? */
memcpy( str->str + str->length?? append?? length );
str->length+= length;                              /* ???????str?μ???? */
str->str[str->length]= 0; /* Safety for C programs */        /* ??????????????’

主站蜘蛛池模板: 久久天天躁夜夜躁狠狠躁2020 | 国产成人一级片 | 本道综合| 天天干天天玩天天操 | 伦理影院在线观看 | 91香蕉视频导航 | 91短视频在线高清hd | 国产福利在线网址成人 | 国产成人精品视频频 | 中文字幕亚洲图片 | 99亚洲精品视频 | 国产xxxx做受性欧美88 | 9i9精品国产免费久久 | 午夜香蕉视频 | 一个人看的免费视频www | 老司机午夜精品视频在线观看免费 | 色偷偷偷 | 欧美日韩一日韩一线不卡 | 全黄大全大色全免费大片 | 成人a大片高清在线观看 | 国产成人精品s8p视频 | 97免费在线观看视频 | 免费在线色 | 123日本不卡在线观看 | 免费观看一级特黄欧美大片 | 最近2019免费中文字幕6 | 欧美视频性 | 美女视频黄的免费视频网页 | 最近免费中文字幕高清大全 | 欧美午夜免费看爽爽爽 | 一二三四在线视频播放社区 | 日韩在线观看视频黄 | a一级毛片| 在线视频亚洲一区 | 亚洲婷婷网 | h视频在线看 | avav在线看 | 福利视频午夜 | 亚洲一级毛片在线观 | 四虎永久在线精品波多野结衣 | 亚洲手机国产精品 |