From: Florian G. <re...@us...> - 2007-12-17 20:50:04
|
Update of /cvsroot/perfparse/_perfparse/libpp_common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21824/libpp_common Modified Files: config_file.c libpp_common.h Log Message: replace macro with function should make code make better to debug - and probably even smaller. Index: libpp_common.h =================================================================== RCS file: /cvsroot/perfparse/_perfparse/libpp_common/libpp_common.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** libpp_common.h 15 Dec 2007 23:30:56 -0000 1.9 --- libpp_common.h 17 Dec 2007 20:49:53 -0000 1.10 *************** *** 60,64 **** #define LOG_DEBUG3 64 #define LOG_DEBUG2 32 ! #define LOG_DEBUG1 16 #define LOG_INFO 8 #define LOG_WARNING 4 --- 60,64 ---- #define LOG_DEBUG3 64 #define LOG_DEBUG2 32 ! #define LOG_STATISTICS 16 #define LOG_INFO 8 #define LOG_WARNING 4 *************** *** 183,186 **** --- 183,190 ---- #define config_get_value_as_integer(id) (config[id].integer) #define config_get_value_as_boolean(id) (config[id].boolean) + void config_item_add(config_item_t *cd,config_item_id_e x, char *skey, + char *svalue, const char *sdesc, const char *ldesc, char *sopt, char *lopt, type_e ttype, + int bin_config_file); + void config_definition_init(const char*default_error_log); Index: config_file.c =================================================================== RCS file: /cvsroot/perfparse/_perfparse/libpp_common/config_file.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** config_file.c 14 Dec 2007 21:42:17 -0000 1.6 --- config_file.c 17 Dec 2007 20:49:53 -0000 1.7 *************** *** 54,58 **** char *my_gethostname(void) { ! pp_log(__FILE__,__LINE__,LOG_DEBUG_FUNCTION,_("my_gethostname() called\n")); char *s=NULL; #if defined (OS_SOLARIS) --- 54,58 ---- char *my_gethostname(void) { ! pp_log_func; char *s=NULL; #if defined (OS_SOLARIS) *************** *** 88,103 **** } ! #define config_item_add(cd, x, skey, svalue, sdesc, ldesc, sopt, lopt, ttype, bin_config_file) \ ! cd[x].key = strdup(skey); \ ! cd[x].value = svalue?strdup(svalue):NULL; \ ! cd[x].short_description = strdup(sdesc); \ ! cd[x].long_description = strdup(ldesc); \ ! cd[x].short_option = sopt?strdup(sopt):NULL; \ ! cd[x].long_option = lopt?strdup(lopt):NULL; \ ! cd[x].integer = svalue?strtol(svalue,NULL,10):0; \ ! cd[x].boolean = strtoboolean(svalue); \ ! cd[x].in_config_file = bin_config_file; \ cd[x].type = ttype; ! void config_definition_init(const char*default_error_log) { --- 88,106 ---- } ! void config_item_add(config_item_t *cd,config_item_id_e x, char *skey, ! char *svalue, const char *sdesc, const char *ldesc, char *sopt, char *lopt, type_e ttype, ! int bin_config_file) { ! ! cd[x].key = strdup(skey); ! cd[x].value = svalue?strdup(svalue):NULL; ! cd[x].short_description = strdup(sdesc); ! cd[x].long_description = strdup(ldesc); ! cd[x].short_option = sopt?strdup(sopt):NULL; ! cd[x].long_option = lopt?strdup(lopt):NULL; ! cd[x].integer = svalue?strtol(svalue,NULL,10):0; ! cd[x].boolean = strtoboolean(svalue); ! cd[x].in_config_file = bin_config_file; cd[x].type = ttype; ! } void config_definition_init(const char*default_error_log) { *************** *** 108,112 **** config_item_add(config_definition, CONFIG_ITEM_ID_CONFIG_FILE, "Config_File", "/" SYSCONFDIR "/" CONFIG_FILE , _("Config file"), _("File for Perfparse configuration"), "-c", "--config-file", TYPE_STRING, 0); config_item_add(config_definition, CONFIG_ITEM_ID_ERROR_LOG, "Error_Log", default_error_log, _("Perfparse log"), _("File where Perfparse logs messages"), "-e", "--error-log", TYPE_STRING, 1); ! config_item_add(config_definition, CONFIG_ITEM_ID_ERROR_LOG_LEVEL, "Error_Log_Level", "255", _("Perfparse log level"), _("Error log level"), NULL, "--error-log-level", TYPE_INT, 1); config_item_add(config_definition, CONFIG_ITEM_ID_ERROR_LOG_ROTATE, "Error_Log_Rotate", "yes", _("Perfparse log rotate"), _("Rotate Perfparse log files"), NULL, NULL,TYPE_BOOLEAN, 1); config_item_add(config_definition, CONFIG_ITEM_ID_ERROR_LOG_KEEP_N_DAYS, "Error_Log_Keep_N_Days", "7", _("Keep N days of error log"), _("Keep N days of error log. Compress recent logs and remove too old ones"), NULL, NULL,TYPE_INT, 1); --- 111,115 ---- config_item_add(config_definition, CONFIG_ITEM_ID_CONFIG_FILE, "Config_File", "/" SYSCONFDIR "/" CONFIG_FILE , _("Config file"), _("File for Perfparse configuration"), "-c", "--config-file", TYPE_STRING, 0); config_item_add(config_definition, CONFIG_ITEM_ID_ERROR_LOG, "Error_Log", default_error_log, _("Perfparse log"), _("File where Perfparse logs messages"), "-e", "--error-log", TYPE_STRING, 1); ! config_item_add(config_definition, CONFIG_ITEM_ID_ERROR_LOG_LEVEL, "Error_Log_Level", "15", _("Perfparse log level"), _("Error log level"), "-x", "--error-log-level", TYPE_INT, 1); config_item_add(config_definition, CONFIG_ITEM_ID_ERROR_LOG_ROTATE, "Error_Log_Rotate", "yes", _("Perfparse log rotate"), _("Rotate Perfparse log files"), NULL, NULL,TYPE_BOOLEAN, 1); config_item_add(config_definition, CONFIG_ITEM_ID_ERROR_LOG_KEEP_N_DAYS, "Error_Log_Keep_N_Days", "7", _("Keep N days of error log"), _("Keep N days of error log. Compress recent logs and remove too old ones"), NULL, NULL,TYPE_INT, 1); |