本文整理汇总了C++中config_destroy函数的典型用法代码示例。如果您正苦于以下问题:C++ config_destroy函数的具体用法?C++ config_destroy怎么用?C++ config_destroy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了config_destroy函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: __config_read
static int __config_read(config_t *config, FILE *stream, const char *filename,
const char *str)
{
yyscan_t scanner;
struct scan_context scan_ctx;
struct parse_context parse_ctx;
YY_BUFFER_STATE buffer = NULL;
int r;
/* Reinitialize the config */
void (*destructor)(void *) = config->destructor;
unsigned short tab_width = config->tab_width;
unsigned short flags = config->flags;
config_destroy(config);
config_init(config);
config->destructor = destructor;
config->tab_width = tab_width;
config->flags = flags;
parsectx_init(&parse_ctx);
parse_ctx.config = config;
parse_ctx.parent = config->root;
parse_ctx.setting = config->root;
__config_locale_override();
scanctx_init(&scan_ctx, filename);
scan_ctx.config = config;
libconfig_yylex_init_extra(&scan_ctx, &scanner);
if(stream)
libconfig_yyrestart(stream, scanner);
else /* read from string */
buffer = libconfig_yy_scan_string(str, scanner);
r = libconfig_yyparse(scanner, &parse_ctx, &scan_ctx);
if(r != 0)
{
config->error_file = scanctx_current_filename(&scan_ctx);
config->error_type = CONFIG_ERR_PARSE;
}
libconfig_yylex_destroy(scanner);
config->filenames = scanctx_cleanup(&scan_ctx, &(config->num_filenames));
parsectx_cleanup(&parse_ctx);
__config_locale_restore();
return(r == 0 ? CONFIG_TRUE : CONFIG_FALSE);
}
开发者ID:anagno,项目名称:imretOpenMVG,代码行数:53,代码来源:libconfig.c
示例2: readCfgCond
int readCfgCond (void) {
config_t cfg;
config_init(&cfg);
/* Read the file. If there is an error, report it and exit. */
if (!config_read_file(&cfg, config_cond_path)) {
printf("\n%s:%d - %s", config_error_file(&cfg), config_error_line(&cfg), config_error_text(&cfg));
config_destroy(&cfg);
return -1;
}
/* */
if (!config_lookup_int(&cfg, "minTemp", &minTemp)) printf("\nNo 'minTemp' setting in configuration file.");
if (!config_lookup_int(&cfg, "maxTemp", &maxTemp)) printf("\nNo 'maxTemp' setting in configuration file.");
if (!config_lookup_int(&cfg, "minHum", &minHum)) printf("\nNo 'minHum' setting in configuration file.");
if (!config_lookup_int(&cfg, "maxHum", &maxHum)) printf("\nNo 'maxHum' setting in configuration file.");
if (!config_lookup_int(&cfg, "webOR", &webOR)) printf("\nNo 'webOR' setting in configuration file.");
config_destroy(&cfg);
return 0;
}
开发者ID:az0ne,项目名称:Automated-Mushroom-Cultivator,代码行数:21,代码来源:mycodo.c
示例3: main
/**
* Main test function
*/
int main(int argc, char **argv)
{
int err = FALSE;
config_init(&cfg);
config_check(&cfg);
err |= test_compare();
config_destroy(&cfg);
return err;
}
开发者ID:Kolpashnikova,项目名称:harry,代码行数:15,代码来源:sim_coefficient.c
示例4: bot_destroy
int bot_destroy(struct bot* b)
{
config_write(b->conf, "config.conf");
conn_destroy(b->conn);
config_destroy(b->conf);
free(b->conn);
free(b->conf);
b->conn=NULL;
b->conf=NULL;
if(!b->conn && !b->conf) return 0;
else return -1;
}
开发者ID:Detegr,项目名称:CBot,代码行数:12,代码来源:bot.c
示例5: unload_module
static int unload_module(void) {
struct DFITCUserLogoutField req = { 0 };
strncat(req.AccountID, userid, sizeof req.AccountID - 1);
xspeed_l2api_user_logout(l2api, &req);
/* FIXME: ?! */
sleep(1);
xspeed_l2api_destory(l2api);
xspeed_l2spi_destroy(l2spi);
config_destroy(cfg);
return unregister_application(app);
}
开发者ID:wang-shun,项目名称:xcb,代码行数:12,代码来源:md_xspeed2.c
示例6: terminarCPUSinPCB
void terminarCPUSinPCB() {
t_datosEnviar* info1 = pedirPaquete("a", CPU_PCP_DISCONNECTION, 2);
t_datosEnviar* info = pedirPaquete("a", UMV_CAE_CPU, 2);
common_send(umvSocket, info, NULL );
common_send(pcpSocket, info1, NULL );
destruirPaquete(info1);
destruirPaquete(info);
close(umvSocket);
close(pcpSocket);
config_destroy(configuracion_CPU);
exit(0);
}
开发者ID:Charlyzzz,项目名称:estaCoverflow,代码行数:12,代码来源:terminateActions.c
示例7: read_local_config_from_file
int read_local_config_from_file(const char * local_path)
{
int rv;
config_t config;
config_init(&config);
rv = config_read_file(&config, local_path);
if (rv != CONFIG_TRUE)
{
config_log_error(&config);
config_destroy(&config);
return rv;
}
rv = read_local_config(&config);
config_destroy(&config);
return rv;
}
开发者ID:snua12,项目名称:zlomekfs,代码行数:21,代码来源:local_config.c
示例8: read_config_auth
static int read_config_auth(char config_file[BUFSIZE], struct config_auth* s_auth)
{
config_t cfg;
const char* buf;
config_init(&cfg);
if (!config_read_file(&cfg, config_file)) {
pam_http_syslog(LOG_ALERT, "%s:%d - %s\n", config_error_file(&cfg),
config_error_line(&cfg), config_error_text(&cfg));
config_destroy(&cfg);
return 0;
}
if (!config_lookup_string(&cfg, "auth_url", &buf)) {
pam_http_syslog(LOG_ALERT, "No 'auth_url' setting in configuration file.");
config_destroy(&cfg);
return 0;
}
s_auth->c_auth_url = strndup(buf, BUFSIZE);
s_auth->c_method = config_get_string(&cfg, "auth_method", DEFAULT_METHOD);
if (strncmp(s_auth->c_method, HTTP_METHOD_GET, 3) != 0 && strncmp(s_auth->c_method, HTTP_METHOD_POST, 4) != 0) {
pam_http_syslog(LOG_ALERT, "Wrong 'auth_method' setting in configuration file (%s).", s_auth->c_method);
config_destroy(&cfg);
return 0;
}
s_auth->c_username_field = config_get_string(&cfg, "auth_username_field", DEFAULT_USERNAME_FIELD);
s_auth->c_password_field = config_get_string(&cfg, "auth_password_field", DEFAULT_PASSWORD_FIELD);
if (!config_lookup_int64(&cfg, "auth_timeout", &s_auth->timeout)) {
s_auth->timeout = DEFAULT_CURL_TIMEOUT;
}
if (!config_lookup_int64(&cfg, "auth_success_code", &s_auth->success_code)) {
s_auth->success_code = DEFAULT_HTTP_SUCCESS_CODE;
}
config_destroy(&cfg);
return 1;
}
开发者ID:AlexandrVLopatin,项目名称:pam_http,代码行数:40,代码来源:pam_http.c
示例9: dhcp_edit_read_cfg
void dhcp_edit_read_cfg(void)
{
config_t cfg, *cf;
int i, r;
char token[MAX_LEN];
const char *file = NULL;
const char *name = NULL;
cf = &cfg;
config_init(cf);
if (!config_read_file(cf, "configuracion.cfg"))
goto error;
/* Buscamos redes de hosts para leer desde configuracion.cfg */
for (i=0;i<MAX_N_REDES;i++) {
sprintf(token,"dhcpdconf%i", i);
r = config_lookup_string(cf, token, &file);
if (r == 0)
break;
sprintf(token,"network%i", i);
r = config_lookup_string(cf, token, &name);
if (r == 0)
goto error;
strcpy(redes[i].file, file);
strcpy(redes[i].name, name);
}
config_destroy(cf);
return;
error:
perror("Error al leer la configuracion\n");
config_destroy(cf);
exit(1);
}
开发者ID:zrafa,项目名称:dhcpdconfedit,代码行数:40,代码来源:dhcpdedit.c
示例10: main
int main (int argc, char **argv) {
int error = 0;
char *config_file = NULL;
struct config_t cfg;
int result;
int i;
int c;
while ((c = getopt_long (argc, argv,
"h" /* help */
"c:", /* config file */
long_options, (int *) 0)) != EOF) {
switch (c) {
case 'h':
usage (0);
case 'c':
config_file = optarg;
break;
}
}
config_init(&cfg);
if (config_file == NULL) {
config_file = CONFIG_FILENAME;
}
if (config_read_file(&cfg, config_file) != CONFIG_TRUE) {
fprintf(stderr, "config parse error in %s:%d - %s\n",
config_file,
config_error_line(&cfg),
config_error_text(&cfg));
config_destroy(&cfg);
exit(EXIT_FAILURE);
}
if (error = eosimias_init(&state, &cfg)) {
fprintf (stderr, "eosimias_init returned: %s", eosimias_error_string(error));
}
// if (error = eocene_init(state)) {
// fprintf (stderr, "eocene_init returned: %s", eosimias_error_string(error));
// }
if (error = eonessa_init(state)) {
fprintf (stderr, "eonessa_init returned: %s", eosimias_error_string(error));
}
state->run();
return(0);
}
开发者ID:whitehse,项目名称:anthidium,代码行数:52,代码来源:anthidium.c
示例11: get_conf_string
void get_conf_string (char *key, char *value) {
config_t *conf = &(config_t) {};
config_init (conf);
config_read_file (conf, "TSECDecoder.conf");
char *tmp;
if (config_lookup (conf, key) == NULL)
return;
config_lookup_string (conf, key, (const char **)&tmp);
if (tmp == NULL)
return;
memcpy (value, tmp, strlen (tmp));
config_destroy (conf);
}
开发者ID:derek-chou,项目名称:TSECDecoder,代码行数:13,代码来源:common.c
示例12: upd8_config_destroy
void upd8_config_destroy(upd8_config_t *config) {
if (config == NULL) {
return;
}
for (int i = 0; i > config->num_sources; ++i) {
upd8_source_destroy(&(config->sources[i]));
}
free(config->sources);
config->sources = NULL;
config_destroy(config->cfg);
config->cfg = NULL;
}
开发者ID:shalecraig,项目名称:updatemgr,代码行数:13,代码来源:config.c
示例13: conf_read_file
int conf_read_file (config_t *config, const char *config_filename)
{
config_init (config);
if (!config_read_file (config, config_filename)) {
ShowError ("%s:%d - %s\n", config_error_file (config),
config_error_line (config), config_error_text (config));
config_destroy (config);
return 1;
}
return 0;
}
开发者ID:Celso1415,项目名称:Fusion,代码行数:13,代码来源:conf.c
示例14: init
static void init(void)
{
int i;
double bpm;
double decay;
int samp_rate;
int min_burst;
int burst_increase;
int min_gain;
int gain_increase;
int detune;
config_init(&cfg);
if(!config_read_file(&cfg, CONFIG_FILE))
{
fprintf(stderr, "%s:%d - %s\n", config_error_file(&cfg),
config_error_line(&cfg), config_error_text(&cfg));
config_destroy(&cfg);
exit(EXIT_FAILURE);
}
if(!config_lookup_float(&cfg, "bpm", &bpm))
config_die("bpm");
if(!config_lookup_float(&cfg, "subdiv", &subdiv))
config_die("subdiv");
if(!config_lookup_int(&cfg, "samp_rate", &samp_rate))
config_die("samp_rate");
if(!config_lookup_int(&cfg, "min_burst", &min_burst))
config_die("min_burst");
if(!config_lookup_int(&cfg, "burst_increase", &burst_increase))
config_die("burst_increase");
if(!config_lookup_float(&cfg, "decay", &decay))
config_die("decay");
if(!config_lookup_int(&cfg, "min_gain", &min_gain))
config_die("min_gain");
if(!config_lookup_int(&cfg, "gain_increase", &gain_increase))
config_die("gain_increase");
if(!config_lookup_int(&cfg, "detune", &detune))
config_die("detune");
note_length = (float)samp_rate * 60 * subdiv / bpm;
system_init();
agent_count = system_get_agent_count();
synths = calloc(agent_count, sizeof(Synth *));
for(i = 0; i < agent_count; i ++) {
float pan = ((float)i / 20) * ((i % 2) * 2 - 1) + .5;
synths[i] = synth_create(samp_rate, min_burst + i * burst_increase,
decay, pan, min_gain + gain_increase * i, detune);
}
}
开发者ID:andreasjansson,项目名称:subsumption-music,代码行数:51,代码来源:source.c
示例15: get_server_config
int get_server_config(s_config *c, char *config_path)
{
config_t cfg;
config_setting_t *modules_setting, *module_setting;
unsigned int count, i;
const char *module_name;
config_init(&cfg);
if (!config_read_file(&cfg, config_path)) {
config_destroy(&cfg);
return CONFIG_FILE_READ_ERROR;
}
if (config_lookup_int(&cfg, "port", &(c->port))
&& config_lookup_string(&cfg, "host", &(c->host))
&& config_lookup_string(&cfg, "web_root", &(c->web_root))
&& config_lookup_string(&cfg, "web_prefix", &(c->web_prefix))
&& config_lookup_string(&cfg, "api_prefix", &(c->api_prefix))
&& config_lookup_string(&cfg, "index_file", &(c->index_file))
&& config_lookup_string(&cfg, "api_modules_path", &(c->api_modules_path))
&& config_lookup_int(&cfg, "buffer_size", &(c->buffer_size))
&& config_lookup_int(&cfg, "api_modules_number", &(c->api_modules_number))
) {
c->buffer = (char*) calloc((size_t) c->buffer_size, sizeof(char));
/* Output a list of all movies in the inventory. */
modules_setting = config_lookup(&cfg, "api_modules");
if (modules_setting != NULL) {
count = (unsigned int) config_setting_length(modules_setting);
if (count != (unsigned int) c->api_modules_number)
return CONFIG_INCONSISTENT_DATA;
else if (count == 0)
return CONFIG_FILE_READ_OK;
c->api_modules_names = malloc(count * sizeof(char*));
for (i = 0; i < count; ++i) {
module_setting = config_setting_get_elem(modules_setting, i);
module_name = config_setting_get_string(module_setting);
c->api_modules_names[i] = module_name;
}
map_init(&c->api_modules, c->api_modules_number);
}
return CONFIG_FILE_READ_OK;
}
else
return CONFIG_MISSING_KEY;
}
开发者ID:padawin,项目名称:web-server,代码行数:51,代码来源:config.c
示例16: main
int main(int argc, char **argv)
{
config_t cfg, *cf;
const config_setting_t *figuras, *figura_actual;
const char *base = NULL;
int count, n, enabled;
int xInit,yInit;
cf = &cfg;
config_init(cf);
if (!config_read_file(cf, "Archivos de Configuracion/test.cfg")) {
fprintf(stderr, "%s:%d - %s\n",
config_error_file(cf),
config_error_line(cf),
config_error_text(cf));
config_destroy(cf);
return(EXIT_FAILURE);
}
figuras = config_lookup(cf, "Figuras");
count = config_setting_length(figuras);
for (n = 0; n < count; n++) {
figura_actual = config_setting_get_elem(figuras,n);
config_setting_lookup_int(figura_actual,"Xinit",&xInit);
printf("x: %d \n",xInit);
//printf("\t#%d. %d\n", n + 1,
// config_setting_get_int_elem(figuras, n));
}
config_destroy(cf);
return 0;
}
开发者ID:omontes,项目名称:mypthreads,代码行数:38,代码来源:main.c
示例17: terminate
/* Handles the termination process and frees if required */
void terminate(int signum) {
/* Check if pthread_t has been initialized from default value and is still alive,
* if so, cancel and join it. */
if(!pthread_equal(watchMixerThread, mainThread) && pthread_kill(watchMixerThread, 0) == 0) {
if(pthread_cancel(watchMixerThread) != 0)
syslog(LOG_WARNING, "Unable request cancelation for mixer thread: %s", strerror(errno));
if((errno = pthread_join(watchMixerThread, NULL)) != 0)
syslog(LOG_WARNING, "Unable to join mixer thread: %s\n", strerror(errno));
}
if(!pthread_equal(interfaceListenThread, mainThread) && pthread_kill(interfaceListenThread, 0) == 0) {
if(pthread_cancel(interfaceListenThread) != 0)
syslog(LOG_WARNING, "Unable request cancelation for serial thread: %s", strerror(errno));
if((errno = pthread_join(interfaceListenThread, NULL)) != 0)
syslog(LOG_WARNING, "Unable to join serial thread: %s\n", strerror(errno));
}
if(!pthread_equal(statusQueryThread, mainThread) && pthread_kill(statusQueryThread, 0) == 0) {
if(pthread_cancel(statusQueryThread) != 0)
syslog(LOG_WARNING, "Unable request cancelation for query thread: %s", strerror(errno));
if((errno = pthread_join(statusQueryThread, NULL)) != 0)
syslog(LOG_WARNING, "Unable to join query thread: %s\n", strerror(errno));
}
if(common_data.interface)
common_data.interface->deinit();
if(common_data.process)
common_data.process->deinit();
deinitMixer();
if(common_data.volume)
common_data.volume->deinit();
statusInfo.deinit();
config_destroy(&config);
pthread_mutex_destroy(&lockConfig);
pthread_mutex_destroy(&lockProcess);
#ifndef DISABLE_MSQ
deinitMsQ();
#endif
if(lock_file > 0) {
lockf(lock_file, F_ULOCK, 0);
close(lock_file);
unlink(LOCKFILE);
}
syslog(LOG_NOTICE, "Program terminated: %s (%i)", strsignal(signum), signum);
closelog();
exit(EXIT_SUCCESS);
} /* end terminate */
开发者ID:muelmatt,项目名称:synchronator,代码行数:51,代码来源:synchronator.c
示例18: getInfoConf
//METODO PARA OBTENER LOS PARAMETROS DEL ARCHIVO DE CONFIG
void getInfoConf(char* conf) {
t_config* config; //creamos la variable que va a ser el archivo de config
config = config_create(conf); //creamos el "objeto" archivo de config
//OBTENEMOS LOS VALORES DEL ARCHIVO DE CONFIG
//ip_servidor = config_get_int_value(config,"IP_SERVIDOR");
strcpy(ip_servidor, config_get_string_value(config, "IP_SERVIDOR"));
puerto_servidor = config_get_int_value(config, "PUERTO_SERVIDOR");
printf("Extraccion correcta del archivo de configuracion \n");
config_destroy(config); //destruimos el "objeto" archivo de config
}
开发者ID:GastonTS,项目名称:tp-2015-1c-sachida,代码行数:15,代码来源:servidor.c
示例19: reload_module
static int reload_module(void) {
int res;
msgs_unhook_name(inmsg, vxo_exec);
config_destroy(cfg);
table_clear(spots);
load_config();
if ((res = msgs_hook_name(inmsg, vxo_exec, vxo_msgs)) < 0) {
if (res == -2)
xcb_log(XCB_LOG_WARNING, "Queue '%s' not found", inmsg);
return MODULE_LOAD_FAILURE;
}
return MODULE_LOAD_SUCCESS;
}
开发者ID:faruto,项目名称:xcb-modules,代码行数:14,代码来源:app_vxo.c
示例20: test_set_get_func
test_result_t test_set_get_func(test_data_t data)
{
test_config_data_t *test_data = (test_config_data_t *)data;
test_result_t result = PASS;
unsigned i = 0;
config_t config = {0};
const char *section_name = NULL;
const char *entry_name = NULL;
const char *entry_value = NULL;
const char *val = NULL;
int ret = 0;
printf("%s\n", test_data->desc);
config_create(&config);
for (i = 0; i < test_data->num_set_entries; i++)
{
section_name = test_data->set_entries[i].section_name;
entry_name = test_data->set_entries[i].entry_name;
entry_value = test_data->set_entries[i].entry_value;
ret = config_set(&config, section_name, entry_name, entry_value);
if (ret != 0)
{
result = FAIL;
}
DEBUG_PRINT("set: section: '%s', name: '%s', value: '%s'\n", section_name, entry_name, entry_value);
}
DEBUG_PRINT("\n");
for (i = 0; i < test_data->num_get_entries; i++)
{
section_name = test_data->get_entries[i].section_name;
entry_name = test_data->get_entries[i].entry_name;
entry_value = test_data->get_entries[i].entry_value;
val = config_get(&config, section_name, entry_name);
if ((val == NULL) || (strcmp(val, entry_value) != 0))
{
result = FAIL;
}
DEBUG_PRINT("get: section: '%s', name: '%s', value: '%s'\n", section_name, entry_name, entry_value);
}
config_destroy(&config);
return result;
}
开发者ID:Rahuldee,项目名称:FreeCoAP,代码行数:50,代码来源:test_config.c
注:本文中的config_destroy函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论