本文整理汇总了C++中ws_malloc函数的典型用法代码示例。如果您正苦于以下问题:C++ ws_malloc函数的具体用法?C++ ws_malloc怎么用?C++ ws_malloc使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ws_malloc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_cam_keyword_log_pre_translate
void get_cam_keyword_log_pre_translate(UserOperate_t* user_op,
ResultContext_t *result_context )
{
WS_ENV* ws_env;
int * my_data = NULL;
(void)ResultContext__getWsEnv(result_context, &ws_env);
my_data = (int*)ws_malloc(ws_env, sizeof(int));
memset(my_data, 0, sizeof(int));
UserOperate__setUserData(user_op, my_data);
}
示例2: route_list_pre_translate
/*****************************************************************************
函 数 名 : route_list_pre_translate
功能描述 : route list 预处理
输入参数 : user_op ---- user_opetate结构
result_context ---- 结果集
输出参数: 无
返 回 值: WS_OK,执行成功
--------------------------------------------------------------------------------
最近一次修改记录:
修改作者: zhuliying
修改目的: 创建新函数
修改日期: 2009年12月14日
*****************************************************************************/
void route_list_pre_translate(UserOperate_t* user_op,
ResultContext_t *result_context )
{
WS_ENV* ws_env;
struct uo_route_list_t *my_data;
(void)ResultContext__getWsEnv(result_context, &ws_env);
my_data = ws_malloc(ws_env, sizeof(struct uo_route_list_t));
memset(my_data, 0, sizeof(struct uo_route_list_t));
UserOperate__setUserData(user_op, my_data);
}
示例3: userdef_pro_rule_list_pre_translate
void userdef_pro_rule_list_pre_translate(UserOperate_t* user_op,
ResultContext_t *result_context )
{
WS_ENV* ws_env;
struct uo_userdef_proto_audit_rule_list_t * my_data = NULL;
(void)ResultContext__getWsEnv(result_context, &ws_env);
my_data = (struct uo_userdef_proto_audit_rule_list_t*)ws_malloc(ws_env, sizeof(struct uo_userdef_proto_audit_rule_list_t));
memset(my_data, 0, sizeof(struct uo_userdef_proto_audit_rule_list_t));
UserOperate__setUserData(user_op, my_data);
}
示例4: search_session_ctl_pre_translate
void search_session_ctl_pre_translate(UserOperate_t* user_op,
ResultContext_t *result_context )
{
WS_ENV* ws_env;
struct uo_session_ctl_t * my_data = NULL;
(void)ResultContext__getWsEnv(result_context, &ws_env);
my_data = (struct uo_session_ctl_t*)ws_malloc(ws_env, sizeof(struct uo_session_ctl_t));
memset(my_data, 0, sizeof(struct uo_session_ctl_t));
UserOperate__setUserData(user_op, my_data);
}
示例5: cam_log_pre_translate
void cam_log_pre_translate(UserOperate_t* user_op, ResultContext_t *result_context)
{
WS_ENV* ws_env;
struct uo_cam_log_t * my_data = NULL;
(void)ResultContext__getWsEnv(result_context, &ws_env);
my_data = (struct uo_cam_log_t*)ws_malloc(ws_env, sizeof(struct uo_cam_log_t));
memset(my_data, 0, sizeof(struct uo_cam_log_t));
my_data->mCamLogId = 0;
UserOperate__setUserData(user_op, my_data);
}
示例6: netaddr_group_pre_translate
/*******************************************************************************
函数名称 : netaddr_group_pre_translate
功能描述 : 地址配置的导出
输入参数 : user_op ---- user_opetate结构
result_context ---- 结果集
输出参数 : 无
返 回 值 : 无
--------------------------------------------------------------------------------
最近一次修改记录:
修改作者 : 张发奇
修改目的 : 整改
修改日期 : 2012年2月19日
*******************************************************************************/
void netaddr_group_pre_translate(UserOperate_t* user_op,
ResultContext_t *result_context )
{
WS_ENV* ws_env;
struct uo_netadr_export * my_data = NULL;
(void)ResultContext__getWsEnv(result_context, &ws_env);
my_data = (struct uo_netadr_export*)ws_malloc(ws_env, sizeof(struct uo_netadr_export));
memset(my_data, 0, sizeof(struct uo_netadr_export));
UserOperate__setUserData(user_op, my_data);
}
示例7: ip6addr_obj_pre_translate
void ip6addr_obj_pre_translate(UserOperate_t* user_op,
ResultContext_t *result_context )
{
WS_ENV* ws_env;
struct uo_ip6addr_info* my_data = NULL;
(void)ResultContext__getWsEnv(result_context, &ws_env);
my_data = (struct uo_ip6addr_info*)ws_malloc(ws_env, sizeof(struct uo_ip6addr_info));
memset(my_data, 0, sizeof(struct uo_ip6addr_info));
UserOperate__setUserData(user_op, my_data);
}
示例8: ws_malloc
void *ws_memdup(const void *ptr, size_t size)
{
unsigned char *data = ws_malloc(size + 1);
if (data == NULL)
return NULL;
memcpy(data, ptr, size);
data[size] = '\0';
return data;
}
示例9: ws__getPoeIlimit
/*****************************************************************************
函 数 名 : ws__getPoeIlimit
功能描述 : 获取poe设备的电流信息
输入参数 : ws_env ---- web service执行环境
输出参数 : ret ---- 得到poe 设备信息
返 回 值 : ERROR_SUCCESS ---- 执行成功
ws_new_soap_fault---- 执行失败
-----------------------------------------------------------------------------
最近一次修改记录:
修改作者: ninglijun
修改目的: 生成新函数
修改日期: 2012年09月14日
*****************************************************************************/
int ws__getPoeIlimit(WS_ENV* ws_env, struct ws__getPoeIlimitResponse * ret)
{
drv_poe_dev_info_s * dev_info = NULL;
struct PoeIlimit * wspoeilimit = NULL;
s32 res,i,num;
s8 buff[32];
dev_info = (drv_poe_dev_info_s*)ws_malloc(ws_env, sizeof(drv_poe_dev_info_s));
if (NULL == dev_info)
{
return ws_send_soap_error(ws_env, poe_error_str(ERR_POE_FAIL_MALLOC));
}
res = poe_syscall_get_poe_dev_info(dev_info);
if(ERROR_SUCCESS != res)
{
return ws_send_soap_error(ws_env, poe_error_str(ERR_POE_FAIL_SYSCALL));
}
num = dev_info->poe_port_cust_ilimit_valid_num;
ret->ret.sum = dev_info->poe_port_cust_ilimit_valid_num;
ret->ret.res_USCOREcount = dev_info->poe_port_cust_ilimit_valid_num;
ret->ret.__size = dev_info->poe_port_cust_ilimit_valid_num;
wspoeilimit = (struct PoeIlimit *)ws_malloc(ws_env, num * sizeof(struct PoeIlimit));
if (NULL == wspoeilimit)
{
return ws_send_soap_error(ws_env, poe_error_str(ERR_POE_FAIL_MALLOC));
}
for(i = 0 ; i < num ; i++)
{
snprintf(buff,sizeof(buff),"%d",(dev_info->poe_port_cust_ilimit_value[i] / 1000));
wspoeilimit[i].poeIlimitVlaue= ws_strdup(ws_env, buff);
wspoeilimit[i].count = i;
}
ret->ret.__ptrres = wspoeilimit;
return ERROR_SUCCESS;
}
示例10: ws__getAvSigsType
s32 ws__getAvSigsType(WS_ENV *soap, struct ws__getAvSigsListType *ret)
{
sqlite3 *dba_con = NULL;
sqlite3_res dba_res = NULL;
u32 count = 0;
u32 i = 0;
s8 *tmp = NULL;
struct AvSigsType *Info = NULL;
dba_con = sqlite3_open_ex(1, AV_DESC_DBFILE);
if (NULL == dba_con)
{
return WS_OK;
}
snprintf(g_sqlite_sql_buf, sizeof(g_sqlite_sql_buf), "SELECT COUNT(*) AS count FROM tb_av_description_category;");
sqlite3_exec_query_ex(dba_con, g_sqlite_sql_buf, &dba_res);
sqlite3_get_u32_ex(dba_res, 0, "count", &count);
ret->ret.sum = (s32)count;
ret->ret.res_USCOREcount = ret->ret.__size = (s32)count;
if(0 == count)
{
goto label_ret;
}
Info = (struct AvSigsType *)ws_malloc(soap, count * sizeof(struct AvSigsType));
if(NULL == Info)
{
goto label_ret;
}
ret->ret.__ptrres = Info;
sqlite3_res_free_ex(dba_res);
dba_res = NULL;
snprintf(g_sqlite_sql_buf, sizeof(g_sqlite_sql_buf), "SELECT * FROM tb_av_description_category;");
sqlite3_exec_query_ex(dba_con, g_sqlite_sql_buf, &dba_res);
for(i = 0; i < count; i++)
{
sqlite3_get_s32_ex(dba_res, (s32)i, "category_id", &Info[i].value);
sqlite3_get_str_ex(dba_res, (s32)i, "category_name", &tmp);
Info[i].name= ws_strdup(soap, tmp);
}
label_ret:
sqlite3_res_free_ex(dba_res);
dba_res = NULL;
sqlite3_close_ex(dba_con);
dba_con = NULL;
return WS_OK;
}
示例11: ws__mldEnableIfGet
/******************************************************************************
函数名称: ws__mldEnableIfGet
功能描述: 取得mld显示信息
输入参数: ret:结果集
输出参数: ret:结果集
返 回 值: 0表示返回成功
--------------------------------------------------------------------------------
最近一次修改记录 :
修改作者: 刘晓贺
修改目的: 新生成函数
修改日期: 2011-2-14
*******************************************************************************/
s32 ws__mldEnableIfGet(WS_ENV * ws_env, struct ws__getIp6McastMldEnableIfResponse *ret)
{
s32 i = 0;
s32 num = 0;
s8 *ifname = NULL;
s32 result = 0;
sqlite3 *db = NULL;
sqlite3_res res = NULL;
struct Ip6McastMldEnableIf *data = NULL;
db = sqlite3_open_ex(1, IP_MC_CFG_DB);
if(NULL == db)
{
return ws_send_soap_error(ws_env, "open basic db failed!");
}
result = sqlite3_exec_query_ex(db, "select count(*) as count from tb_basic_interface_info;", &res);
if(SQLITE_OK != result)
{
sqlite3_close_ex(db);
return ws_send_soap_error(ws_env, "sqlite3_exec_query_ex error!");
}
/*获取当前数据库中的记录数*/
sqlite3_get_s32_ex(res, 0, "count", &num);
/*释放结果集,多次查询时,每次都需要释放*/
sqlite3_res_free_ex(res);
res = NULL;
data = (struct Ip6McastMldEnableIf *)ws_malloc(ws_env, num * sizeof(struct Ip6McastMldEnableIf));
result = sqlite3_exec_query_ex(db, "select * from tb_basic_interface_info;", &res);
if(SQLITE_OK != result)
{
sqlite3_close_ex(db);
return ws_send_soap_error(ws_env, "sqlite3_exec_query_ex error!");
}
for(i = 0; i < num; i++)
{
sqlite3_get_str_ex(res, i, "ifname", &ifname);
data[i].ifname = ws_strdup(ws_env, ifname);
}
/*释放结果集,多次查询时,每次都需要释放*/
sqlite3_res_free_ex(res);
res = NULL;
sqlite3_close_ex(db);
ret->ret.sum = num;
ret->ret.res_USCOREcount = num;
ret->ret.__size = num;
ret->ret.__ptrres = data;
return SQLITE_OK;
}
示例12: netctrlmsg_pre_translate
/* 最近日志、操作日志查询共用 */
void netctrlmsg_pre_translate(UserOperate_t* user_op,
ResultContext_t *result_context )
{
WS_ENV* ws_env;
struct uo_netctrlmsg_t *my_data;
(void)ResultContext__getWsEnv(result_context, &ws_env);
my_data = (struct uo_netctrlmsg_t*)ws_malloc(ws_env, sizeof(struct uo_netctrlmsg_t));
memset(my_data, 0, sizeof(struct uo_netctrlmsg_t));
UserOperate__setUserData(user_op, my_data);
my_data->rowid = 1;
}
示例13: ws__setLevelEnable
/*****************************************************************************
函 数 名: ws__setLevelEnable
功能描述: 下发优先级开关
输入参数: ws_env ---- web service执行环境
levelEnable ----优先级开关
输出参数:
返 回 值: ERR_OK ---- 执行成功
ws_new_soap_fault---- 执行失败
-----------------------------------------------------------------------------
最近一次修改记录:
修改作者: ninglijun
修改目的: 生成新函数
修改日期: 2012年10月9日
*****************************************************************************/
int ws__setLevelEnable(WS_ENV* ws_env,xsd__int levelEnable ,xsd__int* ret)
{
s32 res;
u32 enable;
poe_config_s * poe_config = NULL;
u32 num;
/*从数据库中取值*/
res = poe_dba_get_level_enable(&enable);
if(levelEnable != enable)
{
/*更新数据库*/
res = poe_dba_update_poe_level_enable(levelEnable);
if (ERROR_SUCCESS != res)
{
return ws_send_soap_error(ws_env, poe_error_str(ERR_POE_FAIL_UPDATE_DBA));
}
if(UNENABLE == levelEnable)
{
system("/bin/kill -9 `/sbin/pidof poe_bin`");
res = poe_dba_get_poe_config_count(&num);//获取端口数
if(ERROR_SUCCESS != res)
{
return ws_send_soap_error(ws_env, poe_error_str(ERR_POE_FAIL_GET_DBA));
}
poe_config = (poe_config_s *)ws_malloc(ws_env, num * sizeof(poe_config_s));
if (NULL == poe_config)
{
return ws_send_soap_error(ws_env, poe_error_str(ERR_POE_FAIL_MALLOC));
}
res = poe_dba_get_poe_config(poe_config , num);//从数据库中提取配置信息
if(ERROR_SUCCESS != res)
{
return ws_send_soap_error(ws_env, poe_error_str(ERR_POE_FAIL_GET_DBA));
}
res = poe_syscall_port_power_on(num,poe_config);
if(ERROR_SUCCESS != res)
{
return ws_send_soap_error(ws_env, poe_error_str(ERR_POE_FAIL_SYSCALL));
}
}
else
{
system("/usr/bin/poe_bin");
}
}
return ERROR_SUCCESS;
}
示例14: ip6_pf_export_pre_translate
/*******************************************************************************
函数名称 : ip6_pf_export_pre_translate
功能描述 : 地址配置的导出
输入参数 : user_op ---- user_opetate结构
result_context ---- 结果集
输出参数 : 无
返 回 值 : 无
--------------------------------------------------------------------------------
最近一次修改记录:
修改作者 : 吕进
修改目的 : 新添加函数
修改日期 : 2010.9.13
*******************************************************************************/
void ip6_pf_export_pre_translate(UserOperate_t* user_op,
ResultContext_t *result_context )
{
WS_ENV* ws_env;
struct uo_pf_policy_export * my_data = NULL;
LONGIN_USER_INFO user;
u32 count = 0;
sqlite3 *db;
sqlite3_res res;
(void)ResultContext__getWsEnv(result_context, &ws_env);
my_data = (struct uo_pf_policy_export*)ws_malloc(ws_env, sizeof(struct uo_pf_policy_export));
memset((void *)my_data, 0, sizeof(struct uo_pf_policy_export));
/*初始化数据*/
server_set_type_octet();
server_set_download_filename("ip6_pf_export.csv"); /*要打开下载的文件*/
/*取当前用户信息*/
if(OK == login_get_current_user_info(&user)) /*获取用户信息*/
{
my_data->language = user.language;
}
else
{
my_data->language = LANGUAGE_ENGLISH;
}
db = sqlite3_open_ex(1, IP6_PF_DB);
if ( SQLITE_OK != sqlite3_exec_query_ex(db, "select count(*) AS count FROM "IP6_PF_POLICY_TABLE, &res))
{
goto label_ret;
}
if ( SQLITE_OK != sqlite3_get_u32_ex(res, 0, "count", &count))
{
goto label_ret;
}
server_set_length(count * 1000 * 2);
my_data->offset = 0;
my_data->count = -1;
label_ret:
sqlite3_res_free_ex(res);
/* 关闭数据库连接 */
sqlite3_close_ex(db);
UserOperate__setUserData(user_op, my_data);
}
示例15: ws__getweekinfo
s32 ws__getweekinfo(WS_ENV * soap,struct ws__weektimeinfo *ret)
{
time_t timestart;
time_t timeend;
struct tm tm;
struct week_info * info;
s32 i = 0;
s8 tmp[40];
ret->ret.sum=0;
ret->ret.__size=0;
ret->ret.res_USCOREcount=0;
ret->ret.__ptrres=NULL;
info = ws_malloc(soap,sizeof(struct week_info)*SAVEWEEK);
if(NULL == info)
{
return WS_OK;
}
time(×tart);
localtime_r(×tart,&tm);
timestart = timestart - tm.tm_wday * DAY_TO_SEC;
timestart = timestart/DAY_TO_SEC*DAY_TO_SEC;
for(i = 0;i <SAVEWEEK;i++)
{
localtime_r(×tart,&tm);
info[i].weeknum = tm.tm_yday/WEEK_DAYS + 1;
info[i].weekyear=tm.tm_year+1900;
strftime(tmp,sizeof(tmp),"%Y-%m-%d",&tm);
info[i].weekstart = ws_strdup(soap,tmp);
timeend = timestart + (WEEK_DAYS-1)* DAY_TO_SEC;
localtime_r(&timeend,&tm);
strftime(tmp,sizeof(tmp),"%Y-%m-%d",&tm);
info[i].weekend = ws_strdup(soap,tmp);
info[i].timestart = timestart;
timestart-=WEEK_DAYS*DAY_TO_SEC;
}
ret->ret.sum=SAVEWEEK;
ret->ret.__size=SAVEWEEK;
ret->ret.res_USCOREcount=SAVEWEEK;
ret->ret.__ptrres=info;
return WS_OK;
}