From: Florian G. <re...@us...> - 2007-12-17 20:49:53
|
Update of /cvsroot/perfparse/_perfparse/libpp_mysql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21824/libpp_mysql Modified Files: del_policy.c del_policy.h Log Message: replace macro with function should make code make better to debug - and probably even smaller. Index: del_policy.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/libpp_mysql/del_policy.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** del_policy.c 15 Dec 2007 23:30:56 -0000 1.7 --- del_policy.c 17 Dec 2007 20:49:53 -0000 1.8 *************** *** 226,231 **** ! ! void getRawHostPolicy(t_raw_policyinfo *policyinfo) { pp_log_func; --- 226,233 ---- ! /* get Raw deletion policy info from settings in host. If there are no settings ! in host, get them from hostgroup setting ! */ ! void getRawHostPolicy(t_policyinfo *policyinfo) { pp_log_func; *************** *** 249,253 **** } ! void getRawGroupPolicy(t_raw_policyinfo *policyinfo) { pp_log_func; --- 251,259 ---- } ! /* get Raw deletion policy info from settings in hostgroup. If there are no ! settings in hostgroup, get them from default entries. ! */ ! ! void getRawGroupPolicy(t_policyinfo *policyinfo) { pp_log_func; *************** *** 260,264 **** int maxdel=DEL_POLICY_UNDEFINED; ! while(result_row = mysql_fetch_row(query_result)) { if(!isNull(0)) { // individual settings before group settings if(iData(0)>maxdel || iData(0)==DEL_POLICY_INFINITY) { --- 266,270 ---- int maxdel=DEL_POLICY_UNDEFINED; ! while((result_row = mysql_fetch_row(query_result))) { if(!isNull(0)) { // individual settings before group settings if(iData(0)>maxdel || iData(0)==DEL_POLICY_INFINITY) { *************** *** 283,286 **** --- 289,297 ---- } + + if(policyinfo->iPolicySource==DEL_POLICY_SOURCE_NONE) { + policyinfo->iPolicySeconds=getDefaultRawPolicy(); + policyinfo->iPolicySource=DEL_POLICY_SOURCE_DEFAULT; + } } Index: del_policy.h =================================================================== RCS file: /cvsroot/perfparse/_perfparse/libpp_mysql/del_policy.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** del_policy.h 15 Dec 2007 23:30:56 -0000 1.5 --- del_policy.h 17 Dec 2007 20:49:53 -0000 1.6 *************** *** 24,28 **** DEL_POLICY_SOURCE_HOST_GROUP, DEL_POLICY_SOURCE_HOSTGROUP, ! DEL_POLICY_SOURCE_HOSTGROUP_GROUP}; typedef struct { --- 24,29 ---- DEL_POLICY_SOURCE_HOST_GROUP, DEL_POLICY_SOURCE_HOSTGROUP, ! DEL_POLICY_SOURCE_HOSTGROUP_GROUP, ! DEL_POLICY_SOURCE_DEFAULT}; typedef struct { *************** *** 34,38 **** // raw del policy info ! typedef struct t_raw_policyinfo { int iServiceId; char *sServiceDesc; --- 35,39 ---- // raw del policy info ! typedef struct t_policyinfo { int iServiceId; char *sServiceDesc; *************** *** 41,45 **** int iPolicySource; int iPolicySeconds; ! } t_raw_policyinfo; --- 42,46 ---- int iPolicySource; int iPolicySeconds; ! } t_policyinfo; *************** *** 55,60 **** char *getPolicyDesc(int iPolicy); ! void getRawHostPolicy(t_raw_policyinfo *policyinfo); ! void getRawGroupPolicy(t_raw_policyinfo *policyinfo); int getBinHostPolicy(char *sHost); --- 56,61 ---- char *getPolicyDesc(int iPolicy); ! void getRawHostPolicy(t_policyinfo *policyinfo); ! void getRawGroupPolicy(t_policyinfo *policyinfo); int getBinHostPolicy(char *sHost); |