当前位置: 首页>>代码示例>>C++>>正文


C++ config_free函数代码示例

本文整理汇总了C++中config_free函数的典型用法代码示例。如果您正苦于以下问题:C++ config_free函数的具体用法?C++ config_free怎么用?C++ config_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了config_free函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: nodeup_setup

int nodeup_setup(char *configfile) {
    /* initialize our new clean configuration to default values */
    tc.fd            = -1;
    tc.listen_path   = strdup(DEFAULT_LISTENPATH);
    tc.worker        = strdup(DEFAULT_WORKER);
    tc.max_clients   = DEFAULT_MAXCLIENTS;
    tc.startup_delay = DEFAULT_STARTUPDELAY;
    tc.log_level     = DEFAULT_LOGLEVEL;

    if (cmconf_process_file(configfile, configopts)) {
	config_free(&tc);
	return -1;
    }

    if (conf.listen_path && strcmp(tc.listen_path, conf.listen_path) == 0) {
	tc.fd = conf.fd;
	conf.fd = -1;
    } else {
	tc.fd = nodeup_setup_listen(tc.listen_path);\
    }
    clients = realloc(clients, sizeof(int) * tc.max_clients);

    config_free(&conf);
    memcpy(&conf, &tc, sizeof(struct config_t));
    return 0;
}
开发者ID:rminnich,项目名称:clustermatic,代码行数:26,代码来源:nodeup.c

示例2: main

int main(int argc, char *argv[]) {
	int ret;

	config.logFilePath = DEFAULT_LOG_FILE_PATH;
	config.logLevel = INFO_LOG;

	parse_cmd_line(argc, argv);

	ret = load_config();
	if(ret) {
		log_message(ERROR_LOG, "Loading configuration failed.");
		config_free();
		return 1;
	}

	ret = initialize();
	if(ret != 0) {
		log_message(ERROR_LOG, "initialize is failed.");
		config_free();
		return 1;
	}

	ret = socks_proxy();

	cachemgr_fini();
	log_fini();
	config_free();

	return 0;
}
开发者ID:andriybobyr,项目名称:socks5,代码行数:30,代码来源:main.cpp

示例3: server_start

int server_start()
{
    thread_state_t *state = NULL;

    struct sockaddr_in cli_addr;

    int cli_fd;
    socklen_t clilen = sizeof (cli_addr);


    /* Allocate new configuration */
    if ((server_config = config_new()) == NULL)
    {
        ERROR_MSG("Internal error: Can not allocate configuration\n");
        return 1;
    }

    /* Creating socket */
    if ((server_config->socket_fd = create_server_socket(get_port())) < 0)
    {
        ERROR_MSG("Error: Can not create socket\n");
        config_free(&server_config);
        return 1;
    }

    while (1)
    {
        cli_fd = accept(server_config->socket_fd, (struct sockaddr *)&cli_addr,
                        &clilen);

        if (cli_fd < 0)
        {
            ERROR_MSG("ERROR on accept\n");
            continue;
        }

        if (check_overload() < 0)
        {
            ERROR_MSG("ERROR close\n");
            close(cli_fd);
            continue;
        }

        state = thread_state_new();

        state->cli_fd = cli_fd;

        INCR_SERVER_LOAD;

        pthread_create(&(state->thread), NULL, compile_file, state);
    }

    config_free(&server_config);

    return 0;
}
开发者ID:Nakrez,项目名称:multi,代码行数:56,代码来源:server.c

示例4: ws__natpfHandWorkSyncSend

s32 ws__natpfHandWorkSyncSend(WS_ENV* soap, int *ret)
{
    CURL  *curl = NULL;
    struct hotb_config_s hotb_cfg;
    s8 url[256] = {0};
    s8 name[256]={0}, passwd[256]={0};
    CONFIG *cfg = NULL;
    int web_pro, web_port;
    char path[256]={0};
    char * sid = web_session_id();
    
    hotb_get_config(&hotb_cfg);

    
    sprintf(path, "/var/web/session/_%s", sid);
    if (NULL !=(cfg = config_load(path)))
    {
        strncpy(name,   config_get(cfg, "name", ""), 255);
        strncpy(passwd, config_get(cfg, "password", ""), 255);
        config_free(cfg); cfg = NULL;
    }

    cfg = config_load(CURRENT_WEB_PROTOCOL);
    web_pro = config_getint(cfg, "web_http_srv", 1);
    if(web_pro == 1)
    {
        web_port = config_getint(cfg, "web_http_port", 80);
        snprintf(url, 255, "http://%s:%d/func/web_main/submit/hotbackup/handworksync?user_name=%s&password=%s&get=1",  hotb_cfg.hotb_ip, web_port, name, passwd);
    }
    else
    {
        web_port = config_getint(cfg, "web_https_port", 443);
        snprintf(url, 255, "https://%s:%d/func/web_main/submit/hotbackup/handworksync?user_name=%s&password=%s&get=1", hotb_cfg.hotb_ip, web_port, name, passwd);
    }
    config_free(cfg);

    curl = curl_easy_init();
    if (NULL == curl)
    {
        return ws_send_soap_error(soap, "Failed before sending configures!");
    }
    curl_easy_setopt(curl, CURLOPT_URL, url);
    
    if (CURLE_OK != curl_easy_perform(curl))
    {
        curl_easy_cleanup(curl);
        return ws_send_soap_error(soap, "Failed on sending configures!");
    }
    DPF("path=[%s]\nurl=[%s]\n", path, url);
    curl_easy_cleanup(curl);

    return WS_OK;
}
开发者ID:millken,项目名称:zhuxianB30,代码行数:53,代码来源:ws_hotbackup.c

示例5: main

int main(int argc, const char **argv) {
	if (config_init(argc, argv))
		return 1;
	if (xlib_init()) {
		config_free();
		return 2;
	}
	xlib_mainloop();
	xlib_free(0);
	config_free();
	return 0;
}
开发者ID:AliYousuf,项目名称:Slider,代码行数:12,代码来源:slider.c

示例6: config_dereference

void
config_dereference (config_t * conf)
{
#ifdef WITH_DEBUG
	char szDebug[300];
#endif
	os_mutex_lock (&conf->lock);
	conf->refcount--;
	if (conf->refcount == 0) {
		config_free (conf);
		os_mutex_unlock (&conf->lock);

		/* Ok, this happens outside the lock.  But we know
		 * nothing is using it, so it can't hurt. */
		os_mutex_close (&conf->lock);
		free (conf);
#ifdef WITH_DEBUG
		sprintf (szDebug, "Last reference to config %p, now destroyed",
				 (void *) conf);
		DEBUG_LOG (szDebug);
#endif
	} else {
		os_mutex_unlock (&conf->lock);
	}
}
开发者ID:m3l3m01t,项目名称:antinat,代码行数:25,代码来源:config.c

示例7: set_web_listen_global_conf

/*******************************************************************************
 函数名称  : set_web_listen_global_conf
 功能描述  : 设置web监听全局配置
 输入参数  : global_conf   全局配置项
 输出参数  : 无
 返 回 值      : ERROR_SUCCESS  成功
                              ERROR_FAIL  失败
--------------------------------------------------------------------------------
 最近一次修改记录 :
 修改作者   :      仇俊杰
 修改目的   :      新添加函数
 修改日期   :      2011-1-8
*******************************************************************************/
u32 set_web_listen_global_conf (web_listen_global_cfg * global_conf)
{   
    CONFIG * cfg = NULL;
	s8 user_group_str[USER_GROUP_STRING_LEN] = {0};
    
    cfg = config_load(WEB_LISTEN_CFG_PATH);
    if (NULL == cfg)
    {
        return ERROR_FAIL;
    }
	strncpy(user_group_str, config_get(cfg, "user_group_string","1"), USER_GROUP_STRING_LEN - 1);
    user_group_str[USER_GROUP_STRING_LEN - 1] = 0;
    obj_quote_handle(user_group_str, NETADDR_DEL_REFER);
	
    cfg = config_setint(cfg, "set_enable", global_conf->enable);
    cfg = config_set(cfg, "user_group_string", global_conf->user_group);
    cfg = config_setint(cfg, "aged_time", global_conf->aged_time);
    cfg = config_set(cfg, "popwnd_url", global_conf->popwnd_url);
    cfg = config_setint(cfg, "pf_time", global_conf->pf_time);
 
	obj_quote_handle(global_conf->user_group, NETADDR_ADD_REFER);
	
    config_store(cfg, WEB_LISTEN_CFG_PATH);
    config_free(cfg);

     return ERROR_SUCCESS;
}
开发者ID:millken,项目名称:zhuxianB30,代码行数:40,代码来源:ws_security_web_listen.c

示例8: table_redis_update

static int
table_redis_update(void)
{
	struct config	*c;

	if ((c = config_load(conffile)) == NULL)
		return (0);
	if (config_connect(c) == 0) {
		config_free(c);
		return (0);
	}

	config_free(config);
	config = c;
	return (1);
}
开发者ID:edeln,项目名称:OpenSMTPD,代码行数:16,代码来源:table_redis.c

示例9: client_preprocess

/* FIXME doc */
static int client_preprocess()
{
    if (preprocess(config->argc, config->argv))
    {
        config_free(&config);
        return -1;
    }

    if (send_argv(config->socket_fd, config->argc, config->argv) < 0)
    {
        ERROR_MSG("Error: Can not send argv to the server\n");
        close(config->socket_fd);

        return -1;
    }

    if (send_file(config->socket_fd, config->file->output_file) < 0)
    {
        ERROR_MSG("Error: Can not send file to the server\n");
        close(config->socket_fd);

        return -1;
    }

    return 0;
}
开发者ID:Nakrez,项目名称:multi,代码行数:27,代码来源:client.c

示例10: test_min_realizations_percent

void test_min_realizations_percent(const char * num_realizations_str, const char * min_realizations_str, int min_realizations){
  test_work_area_type * work_area = test_work_area_alloc("test_min_realizations");

  {
    FILE * config_file_stream = util_mkdir_fopen("config_file", "w");
    test_assert_not_NULL(config_file_stream);
    fprintf(config_file_stream, num_realizations_str);
    fprintf(config_file_stream, min_realizations_str);
    fclose(config_file_stream);

    config_type * c = config_alloc();
    config_schema_item_type * item = config_add_schema_item(c , NUM_REALIZATIONS_KEY , true );
    config_schema_item_set_default_type(item, CONFIG_INT);
    config_schema_item_set_argc_minmax( item , 1 , 1);
    item = config_add_schema_item(c , MIN_REALIZATIONS_KEY , false );
    config_schema_item_set_argc_minmax( item , 1 , 2);
    test_assert_true(config_parse(c , "config_file" , "--" , NULL , NULL , false , true ));

    analysis_config_type * ac = create_analysis_config( );
    analysis_config_init(ac, c);

    test_assert_int_equal( min_realizations , analysis_config_get_min_realisations( ac ) );

    analysis_config_free( ac );
    config_free( c );
  }

  test_work_area_free(work_area);
}
开发者ID:danielfmva,项目名称:ert,代码行数:29,代码来源:enkf_analysis_config.c

示例11: TEST_F

TEST_F(ConfigTest, config_remove_section) {
  config_t *config = config_new(CONFIG_FILE);
  EXPECT_TRUE(config_remove_section(config, "DID"));
  EXPECT_FALSE(config_has_section(config, "DID"));
  EXPECT_FALSE(config_has_key(config, "DID", "productId"));
  config_free(config);
}
开发者ID:morrey,项目名称:bt_bcm,代码行数:7,代码来源:config_test.cpp

示例12: btc_config_init

bool btc_config_init(void)
{
    osi_mutex_new(&lock);
    config = config_new(CONFIG_FILE_PATH);
    if (!config) {
        LOG_WARN("%s unable to load config file; starting unconfigured.\n", __func__);
        config = config_new_empty();
        if (!config) {
            LOG_ERROR("%s unable to allocate a config object.\n", __func__);
            goto error;
        }
    }
    if (config_save(config, CONFIG_FILE_PATH)) {
        // unlink(LEGACY_CONFIG_FILE_PATH);
    }

    return true;

error:;
    config_free(config);
    osi_mutex_free(&lock);
    config = NULL;
    LOG_ERROR("%s failed\n", __func__);
    return false;
}
开发者ID:mr-nice,项目名称:esp-idf,代码行数:25,代码来源:btc_config.c

示例13: ws__setDomainListenConfig

/*******************************************************************************
 函数名称  : ws__setDomainListenConfig
 功能描述  : 保存域监听的相关配置
 输入参数  : WS_ENV * ws_env  web services环境
                           int domainListenSwitch    域监听开关
                           int agedTime                  老化时间
 输出参数  : int *ret                          设置结果
 返 回 值     : 
                          WS_OK  成功
--------------------------------------------------------------------------------
 最近一次修改记录 :
 修改作者  : 张岳
 修改目的  : 新函数
 修改日期  : 2013年1月6日
*******************************************************************************/
s32 ws__setDomainListenConfig(WS_ENV* ws_env, int domainListenSwitch, int agedTime, int *ret)
{
	CONFIG *cfg = NULL;
	domain_listen_cfg listen_cfg;	
	u32 res = ERROR_SUCCESS;		

    cfg = config_load(DOMAIN_LISTEN_CFG_PATH);	
    if (NULL == cfg)
    {
        return ERROR_FAIL;
    }	

	/*域监听设置写入配置文件中*/
    cfg = config_setint(cfg, "switch", domainListenSwitch);      
    cfg = config_setint(cfg, "aged_time", agedTime);	
    config_store(cfg, DOMAIN_LISTEN_CFG_PATH);
    config_free(cfg);   
    
    listen_cfg.domain_listen_switch = domainListenSwitch;
    listen_cfg.aged_time = agedTime;
    /*下发到数据面*/	
    res = webauth_syscall_set_domain_listen_config(listen_cfg);
    if(ERROR_SUCCESS != res)
    {
        return ws_new_soap_fault(ws_env, ERROR_SYSTEM);
    }    

    *ret = 0;
    
    return WS_OK;
}
开发者ID:millken,项目名称:zhuxianB30,代码行数:46,代码来源:ws_domain_listen.c

示例14: main

int main(int argc, char **argv) {
    config_load(&config, argc, argv);
    for(int i = optind; i < argc; ++i) {
        printf("option: %s\n", argv[i]);
    }
    config_free(&config);
}
开发者ID:h4ck3rm1k3,项目名称:coyaml,代码行数:7,代码来源:vartest.c

示例15: teardown

void teardown(void)
{
	auth_disconnect();
	db_disconnect();
	config_free();
	g_mime_shutdown();
}
开发者ID:jinwon,项目名称:dbmail,代码行数:7,代码来源:check_dbmail_mailbox.c


注:本文中的config_free函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。