适配fieldstat3新接口(节约10%); 减少strlen的调用(节约2%); 优化栈变量的初始化(节约1%),累计节约13%CPU
This commit is contained in:
@@ -334,26 +334,16 @@ static int set_location(struct TLD_handle_t *_handle, const struct streaminfo *
|
||||
len+=string_cat(buff+len, buff_len-len, location_info->province_full);
|
||||
buff[len++]=',';
|
||||
string_cat(buff+len, buff_len-len, location_info->country_full);
|
||||
|
||||
TLD_append(_handle, field_name, (void *)buff, TLD_TYPE_STRING);
|
||||
break;
|
||||
case 19:
|
||||
len+=string_cat(buff+len, buff_len-len, location_info->country_full);
|
||||
buff[len++]='.';
|
||||
len+=string_cat(buff+len, buff_len-len, location_info->province_full);
|
||||
buff[len++]='.';
|
||||
len+=string_cat(buff+len, buff_len-len, location_info->city_full);
|
||||
|
||||
if(location_info->subdivision_addr!=NULL)
|
||||
{
|
||||
buff[len++]='.';
|
||||
string_cat(buff+len, buff_len-len, location_info->subdivision_addr);
|
||||
}
|
||||
TLD_append(_handle, field_name, (void *)location_info->full_location, TLD_TYPE_STRING);
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
TLD_append(_handle, field_name, (void *)buff, TLD_TYPE_STRING);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user